diff options
author | Indrajith K L | 2021-08-02 17:10:03 +0530 |
---|---|---|
committer | Indrajith K L | 2021-08-02 17:10:03 +0530 |
commit | f2e4f563661e5203f0531e37110d060b20b2f04c (patch) | |
tree | 5d393d164896b9272dbfd85ec9cbbf24ef9c9769 | |
parent | 7d988900e2f73992fea504419d61d4cdf759fedf (diff) | |
download | rebirth-wren-f2e4f563661e5203f0531e37110d060b20b2f04c.tar.gz rebirth-wren-f2e4f563661e5203f0531e37110d060b20b2f04c.tar.bz2 rebirth-wren-f2e4f563661e5203f0531e37110d060b20b2f04c.zip |
* Adds Music Management
* Code Refactoring
* Adds Fonts
-rw-r--r-- | CREDITS.md | 5 | ||||
-rw-r--r-- | assets/fonts/lunchds.ttf | bin | 0 -> 10656 bytes | |||
-rw-r--r-- | assets/level1.json | 22 | ||||
-rw-r--r-- | assets/level1.tmx | 101 | ||||
-rw-r--r-- | assets/musics/01 A Night Of Dizzy Spells.ogg | bin | 0 -> 2552548 bytes | |||
-rw-r--r-- | assets/musics/04 All of Us - Menu.ogg | bin | 0 -> 3850371 bytes | |||
-rw-r--r-- | config.wren | 41 | ||||
-rw-r--r-- | controls.wren | 6 | ||||
-rw-r--r-- | game_state.wren | 14 | ||||
-rw-r--r-- | levels/level1.wren | 7 | ||||
-rw-r--r-- | levels/menu.wren | 25 | ||||
-rw-r--r-- | main.wren | 18 |
12 files changed, 146 insertions, 93 deletions
diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 0000000..63331e9 --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,5 @@ +## Credits + +**Tileset & Sprites** : kenney.nl + +**Music** : Eric Skiff - Song Name - Resistor Anthems - Available at http://EricSkiff.com/music diff --git a/assets/fonts/lunchds.ttf b/assets/fonts/lunchds.ttf Binary files differnew file mode 100644 index 0000000..9acccd4 --- /dev/null +++ b/assets/fonts/lunchds.ttf diff --git a/assets/level1.json b/assets/level1.json index ea69794..5b1ce14 100644 --- a/assets/level1.json +++ b/assets/level1.json @@ -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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":15, "id":4, "name":"Tile Layer 3", "opacity":1, "type":"tilelayer", "visible":true, - "width":16, + "width":20, "x":0, "y":0 }], @@ -69,5 +69,5 @@ "tilewidth":16, "type":"map", "version":1.5, - "width":16 + "width":20 }
\ No newline at end of file diff --git a/assets/level1.tmx b/assets/level1.tmx index 2fe128f..d92b54d 100644 --- a/assets/level1.tmx +++ b/assets/level1.tmx @@ -1,67 +1,64 @@ <?xml version="1.0" encoding="UTF-8"?> -<map version="1.5" tiledversion="1.5.0" orientation="orthogonal" renderorder="right-down" width="16" height="16" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="1"> +<map version="1.5" tiledversion="1.5.0" orientation="orthogonal" renderorder="right-down" width="20" height="15" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="1"> <editorsettings> <export target="level1.json" format="json"/> </editorsettings> <tileset firstgid="1" source="main_tileset.tsx"/> - <layer id="1" name="ground" width="16" height="16"> + <layer id="1" name="ground" width="20" height="15"> <data encoding="csv"> -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 </data> </layer> - <layer id="2" name="buildings" width="16" height="16"> + <layer id="2" name="buildings" width="20" height="15"> <data encoding="csv"> -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,81,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,97,98,99,0,0,0,0,0,0,0, -0,0,0,0,0,0,114,115,116,0,0,0,0,0,0,0, -0,0,0,0,0,0,131,132,133,0,0,0,0,0,0,0, -0,0,0,0,0,0,108,110,109,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,81,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,97,98,99,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,114,115,116,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,131,132,133,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,108,110,109,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127 </data> </layer> - <layer id="4" name="Tile Layer 3" width="16" height="16"> + <layer id="4" name="Tile Layer 3" width="20" height="15"> <data encoding="csv"> -0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 </data> </layer> </map> diff --git a/assets/musics/01 A Night Of Dizzy Spells.ogg b/assets/musics/01 A Night Of Dizzy Spells.ogg Binary files differnew file mode 100644 index 0000000..d2d1702 --- /dev/null +++ b/assets/musics/01 A Night Of Dizzy Spells.ogg diff --git a/assets/musics/04 All of Us - Menu.ogg b/assets/musics/04 All of Us - Menu.ogg Binary files differnew file mode 100644 index 0000000..24989f3 --- /dev/null +++ b/assets/musics/04 All of Us - Menu.ogg diff --git a/config.wren b/config.wren index a1b8cec..eb085c1 100644 --- a/config.wren +++ b/config.wren @@ -1,10 +1,17 @@ import "graphics" for Canvas import "dome" for Window +import "font" for Font + class Config { construct new() { - + __width = 320 + __height = 240 + setup() } + static W {__width} + static H {__height} + static KeyboardConstants { return { "UP": "up", @@ -14,26 +21,24 @@ class Config { "PICK" : "c", "SELECT": "z", "ATTACK": "x", - "QUIT": "escape" + "QUIT": "escape", + "FULLSCREEN": "f" } } - static setup() { - Window.resize(800, 600) - Canvas.resize(800, 600) - Window.title = "REBIRTH" + setup() { + setupWindow() + setupFonts() } - // static KeyboardConstants() { - // return { - // "UP": "up", - // "DOWN": "down", - // "LEFT": "left", - // "RIGHT": "right", - // "PICK" : "c", - // "SELECT": "z", - // "ATTACK": "x", - // "QUIT": "esc" - // } - // } + setupWindow() { + Window.resize(__width*2, __height*2) + Canvas.resize(__width, __height) + Window.title = "REBIRTH" + } + + setupFonts() { + Font.load("font_medium", "assets/fonts/lunchds.ttf", 20) + Font.load("font_small", "assets/fonts/lunchds.ttf", 16) + } }
\ No newline at end of file diff --git a/controls.wren b/controls.wren index 3804020..e8d9d81 100644 --- a/controls.wren +++ b/controls.wren @@ -5,7 +5,11 @@ class Controls { } - static detect(keyCode) { + static isKeyDown(keyCode) { return Keyboard.isKeyDown(keyCode) } + + static justPressed(keyCode) { + return Keyboard[keyCode].justPressed + } }
\ No newline at end of file diff --git a/game_state.wren b/game_state.wren index 94e8a99..4794fb7 100644 --- a/game_state.wren +++ b/game_state.wren @@ -1,10 +1,22 @@ +import "audio" for AudioEngine +import "dome" for Window + class GameState { construct new() { + AudioEngine.load("menu_music","assets/musics/04 All of Us - Menu.ogg") + AudioEngine.load("level1_bg","assets/musics/01 A Night Of Dizzy Spells.ogg") + _fullScreen = false + } + toggleFullscreen() { + _fullScreen = !_fullScreen + Window.fullscreen = _fullScreen } switch(level) { - _currentLevel = level.new() + AudioEngine.stopAllChannels() + _currentLevel = level.new(this) + System.print("Current Level : %(level.name)") } update() { 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 @@ -4,31 +4,33 @@ import "graphics" for Canvas, Color import "dome" for Window, Process import "math" for Math import "config" for Config -import "input" for Keyboard import "./controls" for Controls import "./game_state" for GameState -import "./levels/level1" for Level1 +import "./levels/menu" for Menu class Main { construct new() { - Config.setup() - __gameState = GameState.new() - __gameState.switch(Level1) } init() { - + Config.new() + __gameState = GameState.new() + __gameState.switch(Menu) } update() { - if(Controls.detect(Config.KeyboardConstants["QUIT"])) { + if(Controls.isKeyDown(Config.KeyboardConstants["QUIT"])) { Process.exit(0) } + + if(Controls.justPressed(Config.KeyboardConstants["FULLSCREEN"])) { + __gameState.toggleFullscreen() + } __gameState.update() } draw(dt) { - Canvas.cls(Color.pink) + Canvas.cls(Color.black) __gameState.draw(dt) } } |