JCan you help my problem?

HlkvhsDbvhk
Shojsdv

Add this if statement before the sprite line in draw()

    if bird.y>HEIGHT-50 then
        bird.y=HEIGHT-50
    end


    sprite("Cargo Bot:Title Large Crate 2",bird.x,bird.y,100,100)

THANK YOU SO MUCH

    bird.y = math.min(HEIGHT, bird.y)


    sprite("Cargo Bot:Title Large Crate 2",bird.x,bird.y,100,100)

Using math.min will make the bird stop at the top, but not unnaturally shoot down when hitting the top.

@SkyTheCoder I like that better than an “if” statement.

P

@SkyTheCoder Actually you still need the -50 so the crate stops at the top without going too high.


     bird.y=math.min(HEIGHT-50,bird.y)

Not sure, but I noticed one thing; why do you use CurrentTouch in touched function when you have direct access to the touch, t as you named it?

Edit: @dave1707 I hadn’t ran the project yet, so I didn’t see that it looked better at HEIGHT - 50.

You know what? I have no Idea!

Improved it

@TheRogueBatcher You might have some left over physics bodies that you run into when you restart the game. When the game stops, you need to destroy all the current physics bodies before restarting the game.

Thanks

@TheRogueBatcher - as you haven’t used Codea for a while and seem to have forgotten… and just for clarity for others posting here as you seem to be claiming to have created this yourself.

This code is pretty much what I posted here (http://twolivesleft.com/Codea/Talk/discussion/4627/skullagepk-s-flappy-bird-competition/p1) with changed text, sprites, colours and a couple of variable values.

I’m totally cool with you using it, modifying it and in particular learning from it (though it’s by far the best bit of code out there!) however, as a polite request please make it clear when asking others for help on here that you didn’t write it yourself - I’m sure they’ll still help out.

Otherwise you get yourself into the situation seen a couple of posts above where @SkyTheCoder asked you why you used CurrentTouch instead of t, and you (rep)lied “You know what? I have no idea!” rather than “I don’t know, I didn’t actually create that bit” (FWIW I used CurrentTouch because I was super lazy and throwing the code together)

Anyway, sermon over! @TheRogueBatcher I’m glad your getting something useful out of it and hope this is a springboard to bigger and better things.

@West Thanks for the heads up. Even though I’ll help anyone who ask for it, no questions asked, it is kind of a kick in the pants to see your code being used by someone else without any kind of credit being mentioned. I can stop helping if you want, since it is your code originally.

EDIT: I’m sure others will do the same.

No, feel free to continue helping - I’m not precious about it. I suspect @TheRogueBatcher knows he/she is at it - just wish they’d be a bit more honest. Que sera sera :slight_smile:

The “created by [removed for reasons]
All rights reserved” is deceiving.

Also @West, “in particular learning from it (though it’s by far the best bit of code out there!)” did you mean though it’s by far not the best bit of code out there, or is that good :stuck_out_tongue:

@JakAttak - of course it’s the best, @West was the one who wrote BuzzyFog? Buggy Fozzer? Fobby Mugger? , no I got it, Foggy Bummer.

Haha true, he is the author of Buggy Fozzer, but I don’t think this version is as rich

Haha - oops! Of course I meant it was far from the best bit of code out there! :slight_smile:

P