Rearrange & setup

This commit is contained in:
2026-05-03 23:00:41 +01:00
parent f953f72322
commit 9e85763f9e
12 changed files with 125 additions and 28 deletions
+2 -4
View File
@@ -1,4 +1,4 @@
window = Window.new 400, 400, title: "Button Test"
app = App.new 400, 400, title: "Button Test"
main_scene = Scene.new
@@ -18,6 +18,4 @@ end
main_scene << text
main_scene << rect
window.scenes[:main_scene] = main_scene
window.start :main_scene
app.start main_scene
+11 -14
View File
@@ -5,15 +5,15 @@ width, height = 720, 480
image = Image.new "assets/loading.png"
window = Window.new width, height, title: "My Game", loading_bg: image
app = App.new width, height, title: "My Game", loading_bg: image
window.map_key ?w, :forward
window.map_key ?s, :backward
window.map_key ?a, :left
window.map_key ?d, :right
app.map_key ?w, :forward
app.map_key ?s, :backward
app.map_key ?a, :left
app.map_key ?d, :right
window.map_key ?h, :heal
window.map_key ?t, :place
app.map_key ?h, :heal
app.map_key ?t, :place
menu_scene = Scene.new
@@ -21,14 +21,14 @@ default_font = Font.new "assets/DejaVuSans.ttf", 12, italic: true
start_button = ElementText.new "Start Game", font: default_font, position: {x: 100, y: 100}
game_scene = Scene.new
start_button.on_click do
window.start :game_scene
app.start game_scene
end
menu_scene << start_button
game_scene = Scene.new
world = ElementWorld.new
# world.cam # camera object to control the view of the world, has position, zoom, rotation
@@ -183,7 +183,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
window.scenes[:menu_scene] = menu_scene
window.scenes[:game_scene] = game_scene
window.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