Added Game States, decoupled game from Window class and placed it in Game < GameState

This commit is contained in:
2018-09-09 07:36:59 -05:00
parent bf783381ee
commit 16e0e4dcff
10 changed files with 216 additions and 151 deletions

View File

@@ -20,6 +20,7 @@ class IMICFPS
@debug_color = Color.new(0.0, 1.0, 0.0)
@terrain = terrain
@width, @height, @depth = 0,0,0
@delta_time = Gosu.milliseconds
ObjectManager.add_object(self) if auto_manage
setup
@@ -78,6 +79,7 @@ class IMICFPS
def update
model.update
@delta_time = Gosu.milliseconds
end
# Do two Axis Aligned Bounding Boxes intersect?

View File

@@ -87,8 +87,6 @@ class IMICFPS
end
def update
super
@floor = @terrain.height_at(self, 4.5)
relative_speed = @speed
@@ -153,6 +151,8 @@ class IMICFPS
# distance = 2.0
# x_offset = distance * Math.cos(@bound_model.y_rotation)
# z_offset = distance * Math.sin(@bound_model.y_rotation)
super
end
def button_up(id)

View File

@@ -11,9 +11,9 @@ class IMICFPS
end
def update
super
@y_rotation+=0.01
@y_rotation%=360
super
end
end
end