Discord
Login
Community
DARK THEME

can someone help me

I just need my character to jump

it is important to make the character jump AND to have gravity so the character lands back on the floor. here is a example you can take (you have to write the right names!)

// init = function() end

update = function() position = position+2

if touch.touching and player_y == 0 then player = 7 end

player_vy = hero_vy - 0.3 player_y = max(0,player_y+player_vy) end

draw = function() screen.fillRect(0,0,screen.width,screen.height,"rgb(57,0,57)")

for i=-6 to 6 by 1 screen.drawSprite("floor",i*40-position%40,-80,40) end

screen.drawSprite("player",-80,-50+hero_y,20) end //

hope it work

If you’re using quick engine the easiest code to do is below:

 if [player].vy == 0 then
 [player].vy = [height of jump]
 end

If this is for the game jam I’m sorry I didn’t answer earlier. The games aren’t due until the end of the day on the 7th.

Post a reply

Progress

Status

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