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

2011/8/25

Now here's a challenge...

1
2
3
4
5
6
AwesomeNameGuy AwesomeNameGuy

2011/9/10

#
@kiarocks mik's suggestions sound pretty good. If you decide to work on those I would suggest checking out the angry birds game if you haven't already, there was a free version already mentioned. I am waiting for suggestions myself, my biggest problem I've had seems to be overall program design so I'm happy to recieve any input I can from more experienced programmers.
kiarocks kiarocks

2011/9/11

#
I think you should make the squares stay in a box so they are not every where. I also have seen angry birds on iPod, Mac, and other places.
kiarocks kiarocks

2011/9/11

#
I'll work on the pellet.
kiarocks kiarocks

2011/9/11

#
where is the image stored, @AwesomeNameGuy?
kiarocks kiarocks

2011/9/11

#
nvm
kiarocks kiarocks

2011/9/11

#
@mik, he pellet has image of a rock, but is a 8X8 image and hard to see rotation-there is none
mik mik

2011/9/11

#
Then make a different image. The original has a bird. So. maybe, use a cat. Or a hamster...
kiarocks kiarocks

2011/9/11

#
srry about multiple posts, i hate chrome.
AwesomeNameGuy AwesomeNameGuy

2011/9/11

#
I vote for hamster!
kiarocks kiarocks

2011/9/11

#
*sigh* OK, I'll retrive the hamster.
kiarocks kiarocks

2011/9/12

#
Hamster added!! Now for reflect code, and a floor.
kiarocks kiarocks

2011/9/17

#
hey, @AwesomeNameGuy, i think the dots should be added every few pixels instead of milliseconds. How would i achieve it?
AwesomeNameGuy AwesomeNameGuy

2011/9/18

#
Good question actually. It isn't as trivial as it sounds. Actually I can't think of a way to produce a smooth curve without changing the way the hamster moves. Well, I can, find a parabola intersecting the two points (the start and end position of the hamster per frame) and then draw a dot a certian distance along that curve every few pixels, but who wants to do that? Makes me queasy even thinking about it. But there is a way if you want to mess with the way the hamster moves. Right now it moves a certian number of pixels per frame, (the magnititude of the velocity) and I am too lazy to check my own code right now but I'm pretty sure there is a method in the Vect class that returns a vector of a specified length that points in the same direction as another vector. Start with a really simple example. Say for this paticular frame the hamster is supposed to move a total distance of 24 pixels, which is the total length or "magnititude" of the velocity vector, and we want a dot every 8 pixels, for a starting example. Instead of just moving the hamster a single time for a distance of 24 pixels, like it does now, modify the code so it moves it 3 times in the frame by getting a vector 8 pixels long that points in the same direction as the velocity, add it to the current position, put a dot there, then calculate the a new velocity vector from that point, get another vector 8 pixels long, add it to that position, put another dot at that position and so on. Calculateing a new velocity vector is a problem in itself so if you have a question about that, feel free to ask but I want to keep this post under 10000 words. Also I would have to be careful not to draw the dots until after the hamster moves, so you can't just use getWorld().addObject() to draw them, you would have to store them and then use AddObject in the next frame to draw them, I'm pretty sure at least. Of course not every frame will move the hamster a distance that is evenly divisible by a number that we want, so additional adjustments would have to be made, but I would start from there. Then I would continue by storing the points in a queue or something so for example in the next frame say we are only supposed to move 23 pixels. Uh oh now we can only draw 2 dots. I would still find the position of the 3rd dot and store it, not to be drawn until the hamster moves past that point in the next frame. So it's pretty similar only that third dot would have to be stored for yet another frame and so on. I would also have to be careful only to move the hamster 7 pixels the third time instead of 8. So it's not the least complicated thing ever, but I hope that's enough to point you in the right direction if you really want to try it. To be honest, I would probabily just leave it, and mess with the gravity and force constant and time spacing of the dots instead if you wanted a smoother line. I mean, right now the hamster moves pretty fast, so you could probabily slow that down by messing with the gravity and the force of the slingshot for example. I wonder if Builderboy is still interested in makeing things that stack and can be knocked over. I don't have a lot of time right now but I might start thinking about it soon. To be honest, stacking things is probabily the real tough part.
kiarocks kiarocks

2011/9/18

#
yea, ill see what i can do>.<
kiarocks kiarocks

2011/9/18

#
umm, try looking at the scenario code here.
There are more replies on the next page.
1
2
3
4
5
6