Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How do I make a ruby variable that hols a characters's X coor?

Thank you. where can i find info related to this. like for example a specific event x coor, etc.
Can you please give me the adress of a site were all this is included.
thanks in advance
 
Thanks Again.
Im looking for a site that teach me how todo everything thats done eith events but with/in ruby. Do you know any site like that?
Like for example, how do one make the "wait" command in Ruby?

Thanks in advanc3
 
^^You can't make a wait Command, you just go around and make something similar.

Create a variable and Call it [@wait]

In the method you want to to wait just do:

[@wait -= 1 if !@wait == 0] #It will take one from the @wait if it is not 0
[return if @wait != 0] # In this same order

try setting the @wait to 10 it will take ten frames to do what's below.

^^Hope that helps.
 
Try studying more about the Interpreter classes. There has almost all the information you need, but requires a very good knowledge at RGSS. Even I, when i get some questions, i come to check the default scripts to see how EB did that with RGSS ^^
 
thanks Linkin_T; thanks Chaosg1.

By the way (I know I'm pushing it), how do one makes a picture stay for a long time (like when done with events). I already know how to make the picture appear.
Thanks...
 
Those pictures that we talk about are nothing more than Sprites with Bitmaps in them. (hope you know a little about the engine ^^ if not, just talk.)

Sprites has Z values, and the greater that value is, the more closer it will be to the hero. That makes sprites with lower Z values to stay behind those ones that has higher values. And since everything that you can see in the screen is a sprite and that some sprites changes their Z values periodically, what happens is that some default sprite (that represents tilesets, events or else) have got a Z value greater than that value defined for your sprite. Try that in a call event and note that the sprite will never disappear
Code:
$sprite = Sprite.new
$sprite.bitmap = RPG::Cache.battler("001-Fighter01", 0)
$sprite.z = 10000
See the high Z value? No default sprite even reaches that ^^

Also, sprites stays on the screen unless you dispose them, make them invisible or put their opacity equal to 0. Screen transitions also simulates the sprite erases, but with some more effect and eye-candy into it and affects all the sprites somehow. They don´t need to update unless you have put a flash effect on them.

EDIT: HEY! FOUND A COOL LINK! Sometimes it´s incredible on how i´m patient to write that -_-
 
"Try that in a call event and note that the sprite will never disappear"
"$sprite.z = 10000"

So when I call a picture it disappears because of a low "z" number?
So it means that if a put a high number to z (like 10000) the picture will not dissapear, unless I make another piture with a higher number?

Thank YOU.
By the way, how can a make the {if press "X button" do this} in ruby.
And how can I move my chara and events in ruby.

If you anwser all this you will be god to me.
Thank once more
 
The Input processing is held by the Input module. Each button has his own constant, look:
Code:
Arrow Down = Input::DOWN
Arrow Left = Input::LEFT
Arrow Up = Input::UP
Arrow Right = Input::RIGHT
Shift key = Input::SHIFT
Alt = Input::ALT
Control = Input::CTRL
A key = Input::X
S Key = Input::Y
D Key = Input::Z
Shift or Z keys = Input::A
Space, C or Enter keys = Input::B
ESC, Num 0 or X keys = Input::C
Q or PAGE UP keys = Input::L
W or PAGE DOWN keys = Input::R

There´re basically three modes of key checking, the common check, the trigger ckeck and the repeat check.
Code:
# For the basic check
Input.press?(<your_input_constant_here>)
# For the trigger check
Input.trigger?(<your_input_constant_here>)
# For the repeating check
Input.repeat?(<your_input_constant_here>)
For all of them, if a condition is valid they returns true, else they return false.

Basically, in the first, this condition is of the key is being pressed at the moment. In the second the condition is if the button is being pressed again after some time the player released the button. And in the third the condition takes in consideration how many time the player has been pressing the button (try holding the A key in notepad to take an idea ^^)

There´re more methods, so just check the help file.

Try pasting this in a map event set to parallel process. Also, make another event with ID 2 in any place of the map:
Code:
case Input.dir4
when 2
$game_map.events[2].move_down
when 4
$game_map.events[2].move_left
when 6
$game_map.events[2].move_right
when 8
$game_map.events[2].move_up
end
Weird isn´t it? xD It´s inaccurate but it´s just to show how things works. Basically each event or hero inherits froma class called Game_Character. This means that *almost* all the commands available for the hero will available for events. Also, all the events are held inside a hash in $game_map (so you access it in $game_map.events[<event_id>]), and the hero is represented by $game_player. Those move commands can be used even in hero or events, like:
Code:
# Moving hero down
$game_player.move_down
# Moving event 2 up
$game_map.events[2].move_up
# ... And so on.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top