This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

tradejak66
tradejak66 presents ...

2014/3/13

FlappyBirdAttempt

I needed some motivation for something to code in order to help learn so I tried this. It took around 3 or 4 hours for me. Ive been coding for a few months :3 I can't find out how to stop the score from counting before it hits a pipe. Sorry if the code is hard to read.

2051 views / 451 in the last 7 days

Tags: with-source

open in greenfoot
Your browser does not support the canvas tag.
elias.grollelias.groll

2014/3/13

Maybe use the "isTouching" boolean for collision so you can make it playable :P. In my opinion u also have to remove the Greenfoot.delay(25); and u could make a better fly-engine -(means more beauty and smooth movements :)) I guess you are a beginner so here a tip: (i dont guarantee for the best way doin that :D) create a pointer variable wich u move on a horizontal line in the distance of the movement of the obstacles- ur actor follows it (maybe turnTowards()) :).
tradejak66tradejak66

2014/3/17

Thanks Elias. I'm still very new to the language and learning :3 What's the difference between isTouching and using the getOneIntersectingObject way? I'm trying to incorporate the IsTouching into it and I'm having trouble, so is it worth it? I learn from a class in my highschool so I get about an hour and a half every two days to work on it.
danpostdanpost

2014/3/17

Calling 'isTouching' using 'ClassName' as the class of object to look for: if (isTouching(ClassName.class) is equivalent to: if (getOneIntersectingObject(ClassName.class) != null) If there is no need to know which specific object of the class ClassName your actor was intersecting with, then 'isTouching' would be sufficient. Oftentimes, however, like if the intersecting object needs to be removed from the world, you need to know which object was found to be intersecting. In that case, you would use: Actor intersector = getOneIntersectingObject(ClassName.class) if (intersector != null) { getWorld().removeObject(intersector); }
danpostdanpost

2014/3/17

I missed a closing parenthesis at the end of this line above: if (isTouching(ClassName.class))
elias.grollelias.groll

2014/3/19

:)
elias.grollelias.groll

2014/3/19

In greenfoot the "isTouching()" simplifies his collision-check why shouldnt he get to know that ? Better collisions would make this game more playable & more like FlappyBirds. I dunno what u mean, hes a beginner and ist definetly no crap if heuploads his secenario and asks for help. @tradejak66: I just read ur description :D U could stop reset the timer by adding constructors or doing the collisonCheck() by the world. Then ure able to reset the score int of the worlds score object by simply changing it or creating getters & Setters :)

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.