From f2e4f563661e5203f0531e37110d060b20b2f04c Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 2 Aug 2021 17:10:03 +0530 Subject: * Adds Music Management * Code Refactoring * Adds Fonts --- levels/level1.wren | 7 +++++-- levels/menu.wren | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 levels/menu.wren (limited to 'levels') diff --git a/levels/level1.wren b/levels/level1.wren index c485924..83d626f 100644 --- a/levels/level1.wren +++ b/levels/level1.wren @@ -1,9 +1,12 @@ import "./level_map" for LevelMap +import "audio" for AudioEngine class Level1 { - construct new() { + construct new(gameState) { _level1 = LevelMap.new("level1") + var channel = AudioEngine.play("level1_bg") + channel.volume = 0.2 } - + update() { } diff --git a/levels/menu.wren b/levels/menu.wren new file mode 100644 index 0000000..dcc24e9 --- /dev/null +++ b/levels/menu.wren @@ -0,0 +1,25 @@ +import "graphics" for Canvas, Color +import "./controls" for Controls +import "config" for Config +import "levels/level1" for Level1 +import "audio" for AudioEngine +import "font" for Font + +class Menu { + construct new(gameState) { + __gameState = gameState + var channel = AudioEngine.play("menu_music") + channel.volume = 0.5 + Canvas.font = "font_medium" + } + + update() { + if(Controls.isKeyDown(Config.KeyboardConstants["SELECT"])) { + __gameState.switch(Level1) + } + } + + draw(dt) { + Canvas.print("REBIRTH",Config.W/2 - 40,Config.H/2 - 20, Color.white) + } +} \ No newline at end of file -- cgit v1.2.3