Guest Access
Go to page : 1, 2, 3, 4
Active Member
Active Member
Active Member
profile
handy333
profile
Question
I'm working to make like an opening help window in the item menu via holding the A button.
As you can see, I'm working with this part. I'm trying to turn this 3 into a Global Var. so I can change it and constantly update it.
I want the height of the box to grow from 3 pixels to 64 while the person holds the button and shrinks back to 3 when released.
I'm working to make like an opening help window in the item menu via holding the A button.
- Spoiler:
- #==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Space < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0,0,640,$max)
self.contents = Bitmap.new(width - 32, height - 32)
update
end
As you can see, I'm working with this part. I'm trying to turn this 3 into a Global Var. so I can change it and constantly update it.
I want the height of the box to grow from 3 pixels to 64 while the person holds the button and shrinks back to 3 when released.
Active Member
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
well you cant use the way you ware because classes are constants.
You should give your window a update definition and do the window re-size in there.
Try something like this:
Something like that.
Then change the help window in the item script to ItemWindow_Help.
You should give your window a update definition and do the window re-size in there.
Try something like this:
- Code:
class ItemWindow_Help < Window_Help
def initialize
super
self.width = 0
end
def update
super
if Input.press?(Input::A)
self.width += 3 if self.width < 64
else
self.width -= 3 if self.width > 0
end
end
end
Something like that.
Then change the help window in the item script to ItemWindow_Help.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
Active Member
Active Member
profile
handy333
profile
Forget aboot it, I need help on knowing what CONSTANTS are and what they do.
Edit
I need help on inheritances and what they do.
Edit
I need help on inheritances and what they do.
Active Member
Show Signature
EVENTALIST
EVENTALIST
||||||||||
||||||||||
||||||||||
profile
supercow
profile
thx for the knowledge was wondering about that too although not fully understand yet
||||||||||
Show Signature
||||||||||
Active Member
Active Member
Active Member
profile
handy333
profile
Got it.
class Handy
def
print "Master Hand"
end
end
class Mona < Handy
def
print "Handy and Mona's future!
end
end
Mona.new
(there may be an error)
class Handy
def
print "Master Hand"
end
end
class Mona < Handy
def
print "Handy and Mona's future!
end
end
Mona.new
(there may be an error)
Active Member
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
yea its just inherited values.
A good example in RMXP is the Game_Character class as an adult, Game_Event and Game_Player as child.
- Code:
class Adult
def initialize
@variable = 0
end
def update
@variable += 1
end
def show_txt
print("This is Adult.")
end
end
class Child < Adult
def show_var
print("#{@variable}") # puts 0
update
print("#{@variable}") # puts 1
5.times do |i|
update # updates 5 times
end
print("#{@variable}") # puts 6
@variable -= 2
print("#{@variable}") # puts 4
end
def show_txt
super # runs adult class definition
print("This is child.")
end
end
A good example in RMXP is the Game_Character class as an adult, Game_Event and Game_Player as child.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
NuKa_BuBble
profile
I know what I want to learn. You can choose one/two things or all. The most important. The spoiler hide explications.
1. How fonctions work
2. Errors and bugs resolution.
3. Control the time.
4. Sprites and interractions with player. (Self-switch include )
5. How a shop work.
1. How fonctions work
- Spoiler:
- Like: $game_party.something do that. I want to know what appens. All of the most used fonctions.
2. Errors and bugs resolution.
- Spoiler:
- It's clear here, no? In every script that I make, I get a lot of errors or bugs that I can't resolve.
3. Control the time.
- Spoiler:
- I was always bad in that. Play with second, minutes, hours, wheater, colors.
4. Sprites and interractions with player. (Self-switch include )
- Spoiler:
- When the player press on this, X sprite is show X seconds. At the positions XY, show this sprite on the screen while the switch X is not turned off. When player proceed, show the shop. When this button is press and the player touch the sprite X, self switch X is turn on/off.
5. How a shop work.
- Spoiler:
- I don't understand that too. How the shops work. At the position XY, show the gold windows, here's the selectable windows, show this when you press buy/sell/exit, if you select this, that cost X of that type of points.......
The only one
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
All of those things you can find by studding the default scripts in RMXP. They have labeled what takes place in the code so you get a nice description on what is happening and a good example.
functions are well they work by how you made them. for example,
when called Class.times_five(3) it will take 3 and multiply it by five and give you 15. Understand?
For errors those will be understood over time, its difficult to describe how to read them and tell whats wrong. That and i really cant think of any examples to give you. sorry.
Controlling time:
What do you mean? like to get seconds and mins? you can use this:
then the basic time conversions from there.
you can also time how long a process took by doing this.
More about the Time Class.
functions are well they work by how you made them. for example,
- Code:
def times_five(num)
return num * 5
end
when called Class.times_five(3) it will take 3 and multiply it by five and give you 15. Understand?
For errors those will be understood over time, its difficult to describe how to read them and tell whats wrong. That and i really cant think of any examples to give you. sorry.
Controlling time:
What do you mean? like to get seconds and mins? you can use this:
- Code:
seconds = Graphics.frame_count / Graphics.frame_rate
then the basic time conversions from there.
you can also time how long a process took by doing this.
- Code:
old_time = Time.now
#------------------------------
# example process
x = 1
1000.times{ x *= 2 }
#------------------------------
time = Time.now - old_time
print("That took #{time} seconds.")
More about the Time Class.
EVENTALIST
Show Signature
EVENTALIST
Go to page : 1, 2, 3, 4