Discord
Login
Community
DARK THEME

start screen of a game

I want to put a title screen in my game, but it's stuck. I mixed the codes from the tutorials "title screen" and "platformer tools" on the website, and it won't load. Can someone help me? Here's my code.

init = function() score = 0 Quick.init() Quick.addMap("map",0,30,2500,400) player = Quick.addSprite("player_idle",-930,25,25) Quick.background= ("rgb(142,179,255)") Quick.gravity = 100 Quick.ground =-10000 end

update = function() Quick.update()

if keyboard.RIGHT or keyboard.D then player.vx = 150 player.name = "player_run" else player.vx = 0 player.name = "player_idle" end

if keyboard.LEFT or keyboard.A then player.vx = -150 player.name = "player_run_back" end

if keyboard.UP then player.vy = 150 end

if keyboard.DOWN or keyboard.S then player.name = "player_sit" end

if not player.grounded then player.name = "player_jump"
end

if player.y<-100 then gameover = 1 end Quick.camera.move(player.x)

end

draw = function()

if gameover then screen.clear() screen.drawText("GAME OVER" 0,0,50,"rgb(255,255,255)") else
Quick.update() end

screen.setDrawAnchor(0, 0) screen.setAlpha(0.2) screen.setAlpha(1) screen.drawText("Algodon = " + score, -100, 90,16,"rgb(255, 255, 255)") screen.setDrawAnchor(0, 0)

end

IDK, the lack of formatting makes it hard to read. But all I can think of is that the variable gameover is not defined in the init() function, which I can guess is giving you a warning, and is Quick in your project? It should have a lib folder if you have a library, if not, Quick would not be there and would not be able to help. If you make your project public and don't click on a button that should say along the lines of 'show in explore section', it will be viewable, but would not be findable from the explore section.

for better formatting, put your code in 3 backticks:

this:

​​​​​​​​```

print("my code!")

​​​​​​​```

results in this:

print("my code!)

I have already made my game public, here is the link to it, if you would help me improve it I would greatly appreciate it since it is a school project, I would appreciate any advice.

https://microstudio.dev/i/AngelYael/concretejungle/

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community