From 705886d371cf2cfa619b321c0d87caca0773a789 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Tue, 3 Aug 2021 17:53:10 +0530 Subject: Bug Fixes Player Placement Basic Player Movement --- screens/credit_screen.wren | 83 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 4 deletions(-) (limited to 'screens/credit_screen.wren') diff --git a/screens/credit_screen.wren b/screens/credit_screen.wren index 3b54d2b..59128ba 100644 --- a/screens/credit_screen.wren +++ b/screens/credit_screen.wren @@ -1,13 +1,88 @@ -class CreditScreen { - construct new() { +import "./controls" for Controls +import "./config" for Config +import "audio" for AudioEngine +import "font" for Font +import "graphics" for Canvas, Color +class CreditScreen { + construct new(gameState) { + __gameState = gameState + var channel = AudioEngine.play("credit", 0.5, true) + __credits = [ + { + "text": "A GAME BY", + "padding": 10, + "type": "title" + }, + { + "text": "Indrajith K L", + "padding": 30 + }, + { + "text": "TILESETS & SPRITES", + "padding": 50, + "type": "title" + }, + { + "text": "kenney.nl", + "padding": 70 + }, + { + "text": "MUSIC", + "padding": 90, + "type": "title" + }, + { + "text": "Juhani Junkala & Eric Skiff", + "padding": 110 + }, + { + "text": "SFX", + "padding": 130, + "type": "title" + }, + { + "text": "sfxr", + "padding": 150 + }, + { + "text": "For More Games", + "padding": 170, + "type": "title" + }, + { + "text": "indrajithmakesgames.com", + "padding": 190, + "type": "info" + } + ] } update() { - + if(Controls.justPressed(Config.KeyboardConstants["ATTACK"])) { + __gameState.switch("menu") + } } draw(dt) { - + var x = 0 + var y = 10 + for(credit in __credits) { + drawCredit(credit, x, y) + var y = y + 10 + } + } + + drawCredit(credit, x, y) { + x = Config.W/2 - ((credit["text"].count * 8)/2) + y = credit["padding"] + y + Canvas.print(credit["text"],x ,y , Color.white, credit["type"]=="info" ? "font_minecraft": Font.default) + if(credit["type"]=="title") { + x = x + for(i in 0...(credit["text"].count)) { + Canvas.print("-",x ,y+8 , Color.white, Font.default) + x = x + 8 + } + } } } \ No newline at end of file -- cgit v1.2.3