Fix main loop, add example and cleanup
This commit is contained in:
+9
-9
@@ -5,15 +5,15 @@ width, height = 720, 480
|
||||
|
||||
image = Tiles.from("assets/loading.png").first
|
||||
|
||||
app = App.new width, height, title: "My Game", loading_bg: image # can be image or animation
|
||||
App.run width, height, title: "My Game", loading_bg: image # can be image or animation
|
||||
|
||||
app.map_key ?w, :forward
|
||||
app.map_key ?s, :backward
|
||||
app.map_key ?a, :left
|
||||
app.map_key ?d, :right
|
||||
App.map_key ?w, :forward
|
||||
App.map_key ?s, :backward
|
||||
App.map_key ?a, :left
|
||||
App.map_key ?d, :right
|
||||
|
||||
app.map_key ?h, :heal
|
||||
app.map_key ?t, :place
|
||||
App.map_key ?h, :heal
|
||||
App.map_key ?t, :place
|
||||
|
||||
menu_scene = Scene.new
|
||||
|
||||
@@ -24,7 +24,7 @@ start_button = ElementText.new "Start Game", font: default_font, position: {x: 1
|
||||
game_scene = Scene.new
|
||||
|
||||
start_button.on_click do
|
||||
app.start game_scene
|
||||
App.start game_scene
|
||||
end
|
||||
|
||||
menu_scene << start_button
|
||||
@@ -184,4 +184,4 @@ world.shader :fog do |shader|
|
||||
z = 100 # shaders always appear above normal sprites but z is used to sort them relative to each other, so a shader with z 100 will appear above a shader with z 50, but both will appear above normal sprites
|
||||
end
|
||||
|
||||
app.start menu_scene # first scene to show when the game starts, stops the loading bg
|
||||
App.start menu_scene # first scene to show when the game starts, stops the loading bg
|
||||
|
||||
Reference in New Issue
Block a user