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
mjrb4 mjrb4

2011/8/30

#
@AwesomeNameGuy This may come in handy if you're not there already.
AwesomeNameGuy AwesomeNameGuy

2011/8/31

#
Cool scenario. I'm just sitting down to work on it, as a matter of fact.
kiarocks kiarocks

2011/8/31

#
ill work on gravity this weekend
AwesomeNameGuy AwesomeNameGuy

2011/9/1

#
It will be interesting to see how other people approach this. Anyway just uploade the slingshot scenario here! Edit: hmm. must be doing the url thing wrong Edit #2: Got it working.
danpost danpost

2011/9/2

#
@AwesomeNameGuy -- I changed the code in your Pellet method when testing to see if it has reached the end of the world to
GreenfootImage myImg = getImage();
if (getY() <= 3) myImg.setTransparency(0); else myImg.setTransparency(255);
setImage(myImg);
if ((getX() >= getWorld().getWidth() - 4) || (getX() <= 3) || (getY() >= getWorld().getHeight() - 4)) {
    removePellet(); // multiple steps... needs it's own method
}
It will be removed from the world if it reaches left, right, or bottom edges, but will temporarily 'leave' the top until it returns within the view screen, or is removed when any other edge is reached. Quite puzzling!, it is like the elastic band breaks sometimes. Maybe need to use 'setActOrder()'. I will have to try it out. Although it is more realistic to see it break! :+) No luck with 'setActOrder()'. Still puzzling!
AwesomeNameGuy AwesomeNameGuy

2011/9/3

#
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.
AwesomeNameGuy AwesomeNameGuy

2011/9/6

#
Did some work on the slingshot scenario. I updated it here. Anyway I'd be interested in suggestions for going foward from this point from anybody involved, let me know!
mik mik

2011/9/7

#
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.
bourne bourne

2011/9/8

#
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 =)
danpost danpost

2011/9/8

#
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.
davmac davmac

2011/9/8

#
There is an online version at chrome.angrybirds.com for anyone who hasn't played it. It is "optimized for Chrome" but it runs quite well with Safari too.
AwesomeNameGuy AwesomeNameGuy

2011/9/9

#
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.
AwesomeNameGuy AwesomeNameGuy

2011/9/9

#
Added the suggested changes. You can find the uptate here!
kiarocks kiarocks

2011/9/10

#
hey, what should i work on for this clone?
mik mik

2011/9/10

#
@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?
There are more replies on the next page.
1
2
3
4
5