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.

Help with newbee scripter.

Hi!

I am a newbee RGSS scripter and new to Ruby language. I have experience with other languages. And with OOP.

Read the tutorial that is found here:
http://www.dubealex.com/asylum/index.php?showtopic=4854

I get everything in the beginning but when the window making comes...it´s starts to be a little tricky. Some questions i hope someone has the time to answer:

1. On this line
self.contents.draw_text(305, 0, 100, 32, $game_party.gold.to_s)
We the the public instance variable: gold that is listed under $game_party...it´s easy to find...but later the line:
self.contents.draw_text(480, 0, 100, 32, $game_map.map_id.to_s)
where do we get the map_id from? It is not listed under $game_map.

2. On this line:
actor = $game_party.actors we get the array actors from $game_party so i ran and checked it and it was listed. Later:
self.contents.draw_text(x, y+32, 200, 32, actor.class_name)

Where does the class_name come from? It is not listed under $game_party.

Can someone explain to me this?

Thanx in advance.
 
Fomar0153 said:
1: In game_map you will find:
Code:
  def map_id
    return @map_id
  end

2: The actor is a game_actor class.
That array has the actors that are in the party in it.

Ok...so the firts asnwer:
Why the "instance variables" defentitions in the beginning then if you can use any vairable in the class?

the second answer:
How do you know that this is from the game_actor class? How did you found that out just looking at the game_party class?


And a 3:rd question:
Where can i find the $data_system class?

And a 4th:
When i in my class call a variable like this $game_party.gold what am i doing really? I am not creating an instance of the class. Because then i would have used the "new" keyword...so what am i doing?

Thanx in advance.
 
Scene Title Command new game:

$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new

so that means that when you do $game_player.move_left, you are doing Game_Player.new.move_left
 

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