Log In  


Cart #35889 | 2017-01-17 | Code ▽ | Embed ▽ | No License
1


First cart good enough to show around!
Arrow keys to walk around, x to launch your thalassodromeus into the air, then x to flap! Don't touch water!
Not much to show yet, but you can takeoff, land, crash and reach the end. I'm a total newbie at coding so I've had to totally re-write the code a couple times.

does anyone know how I can make it so that holding down BTN x button doesn't send you up continuously? I've tried btnp and messing with timers but can't seem to get it right (which is frustrating because I actually had it working in a prev. version but forgot how I did it).

1


Hey,

I started as a complete newbie myself, so I know what you are going through. However you have one better on me, because you actually shared a cart here already ;)

Anyway...

You can use the extended button handler function from here to solve your problem. Use either is_pressed() or is_released() with the button you are using to "flap" after including this function in your code. That should solve it.


Thanks! I eventually remembered how I did it in the first place, with a "flap" state that turns off after 10 ticks


if playerstate==4 then

py+=1
px+=1

if btnp(4) then
sfx(0)

t=0
end

if btn(4) and flap==true then
pspbody=20
pspwing=36
t+=1
if t>10 then
flap=false
end
end
psphead=18
psphead2=19
if not btn(4) then
pspbody=17
pspwing=33

flap=true

end
if btn(4) and flap==true then
py-=6

end
if px>goal then px+=0
py+=6
end

end
end


Thanks for sharing! I really like the look and feel of that initial jump launch.



[Please log in to post a comment]