Class: GamesAndRpgParadise::Game_Window
- Inherits:
-
Gosu::Window
show all
- Defined in:
- lib/games_and_rpg_paradise/gui/gosu/final_fantasy/game.rb
Instance Method Summary
collapse
#gosu_button_down?, #image, #image10?, #image1?, #image2?, #image3?, #image4?, #image5?, #image6?, #image7?, #image8?, #image9?, #on_left_arrow_pressed?, #on_right_arrow_pressed?, #q_means_quit, #set_font, #set_title, #sqrt, #tab_key?, #write_this_text
Constructor Details
Returns a new instance of Game_Window.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/games_and_rpg_paradise/gui/gosu/final_fantasy/game.rb', line 20
def initialize
super(384, 256, false)
self.caption = 'King Ruby'
@game_screen = Screen.new
@king = Player.new(collider_layer_name = "colliders")
@mages = Mages.new(collider_layer_name = "mages")
@snake_red = Snake.new(collider_layer_name = "snake_red")
@snake_blue = Snake.new(collider_layer_name = "snake_blue")
@mushrooms = Mushrooms.new(collider_layer_name = "mushrooms")
@chest = Chest.new(collider_layer_name = "chest")
@king.warp(160,88)
@snake_red.warp(48,96)
@snake_blue.warp(304,32)
reset
end
|
Instance Method Details
#draw ⇒ Object
#
draw
Draws the various entities in the game.
#
106
107
108
109
110
111
112
113
114
|
# File 'lib/games_and_rpg_paradise/gui/gosu/final_fantasy/game.rb', line 106
def draw
@game_screen.draw(@king.y, @game_over_red, @game_over_blue)
@king.draw
@mages.draw
@snake_red.draw
@snake_blue.draw
@mushrooms.draw
@chest.draw
end
|
#game_over ⇒ Object
92
93
94
95
96
97
98
99
|
# File 'lib/games_and_rpg_paradise/gui/gosu/final_fantasy/game.rb', line 92
def game_over
if @snake_red.player_dead
@game_over_red = true
end
if @snake_blue.player_dead
@game_over_blue = true
end
end
|
#reset ⇒ Object
42
43
44
45
46
|
# File 'lib/games_and_rpg_paradise/gui/gosu/final_fantasy/game.rb', line 42
def reset
@game_over_red = false
@game_over_blue = false
end
|
#update ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/games_and_rpg_paradise/gui/gosu/final_fantasy/game.rb', line 51
def update
game_over
if @game_over_red == true || @game_over_blue == true
if Gosu.button_down? Gosu::KB_RETURN
initialize
end
else
if Gosu.button_down? Gosu::KB_RIGHT
@king.right
if Gosu.button_down? Gosu::KB_UP
@king.up
elsif Gosu.button_down? Gosu::KB_DOWN
@king.down
end
elsif Gosu.button_down? Gosu::KB_LEFT
@king.left
if Gosu.button_down? Gosu::KB_UP
@king.up
elsif Gosu.button_down? Gosu::KB_DOWN
@king.down
end
elsif Gosu.button_down? Gosu::KB_UP
@king.up
elsif Gosu.button_down? Gosu::KB_DOWN
@king.down
else
@king.idle
end
end
@mages.collision_checker(@king.x, @king.y)
@mushrooms.collision_checker(@king.x, @king.y)
@snake_red.move(@king.x, @king.y, @mushrooms.eaten_shroom_red)
@snake_blue.move(@king.x, @king.y, @mushrooms.eaten_shroom_blue)
@chest.collision_checker(@king.x, @king.y)
end
|