Cool scenario. I'm just sitting down to work on it, as a matter of fact.
ill work on gravity this weekend
I just fixed it. All I needed was a single equals sign in the right place...if you want to know what caused it: When the user clicks, the control of the pellet is taken over by the slingshot object. To check if it needs to relinquish control of the pellet, the sling shot checks where the pellet is. Since the pellet can be fired from any angle, it does this by checking the size of the displacement vector, which measures the distance from the pellet to the slinshot, and that should be getting smaller as the pellet get fired. Once it passes through the slingshot, the distance starts getting bigger, and that is how the slingshot knows to give up control. Now if you click the mouse without moving the pellet, the size of the displacement vector winds up always being zero, and the slingshot won't allow the user to move it, nor will it ever let the pellet go. So it just gets stuck there. Not a hard fix once I figured it out! What made me wonder is why it sometimes stayed stuck even when I reset the program. I also fixed the fact that it fired the pellet slightly too low. Anyway I must have spent at least fifteen minutes shooting pellets from the slingshot yesterday for fun. It's always like that with me with my own programs. I think I will add a couple targets to shoot at and make it into a mini game.
Next you could maybe do some of this:
- Leave a dotted line on the world background where the ball flew along. This helps with adjusting the next shot.
- Add a target. (This doesn't have to be fancy at this stage - maybe just a square box). Recognise when the target gets hit and stop the ball there.
- Provide methods that provide location, speed and angle of the ball at the time you hit the target. This will help with programming the effect on the proper targets later on.
I must admit I have never played Angry Birds or seen it run lol. Will be interested in seeing what you guys come up with =)
I had never heard of it, until last Sunday. Was not sure what it was when this discussion was first started. "Why is there no angry birds clones...?" did not make any sense to me.
The version of angry birds that davemac mentioned is the version I have. I hand't played it until I saw this thread as well. @mik that sounds pretty simple I should have some time to work on it tonight. I'll put the methods for recording the speed and angle stuff in the pellet class in my slingshot demo.
hey, what should i work on for this clone?
@kiarocks - How about making a nicer image for the pellet and animating it (rotating when it hits, etc.)?
Or looking into doing the panning effect where the camera seems to move right to follow the shot, moving the slingshot out and the target into view?