Catapult Issue

Hi there,

Still fairly new to this so please bear with me.

I’ve been following this tutorial online for creating a catapult similar to Angry Birds:

http://developer.anscamobile.com/code/how-make-angry-birds-catapult

I’ve inserted it into my game and changed where the bands are positioned to where I want them by changing the values in the “projectileTouchListener” function. However, it’s still firing the ball in the position of where the bands used to be before I altered it, if that makes sense?

I’m assuming it’s to do with the launching of the player however I’m not really sure what it does.

– Launch player
player.bodyType = “dynamic”
player:applyForce((160 - e.x)*force_multiplier, (_H - 160 - e.y)*force_multiplier, player.x, player.y)
player:applyTorque( 100 )
player.isFixedRotation = false
If anyone could elaborate it would be greatly appreciated.

Thanks :slight_smile:
EDIT: Also, another quick thing, is there any easy way to make a camera follow wherever the ball goes after it’s fired?

Thanks again :slight_smile:

Alex
[import]uid: 120751 topic_id: 24780 reply_id: 324780[/import]

Hey Alex,

Check out the Ghosts VS Monsters sample code, it will not only help you with firing the projectile correctly but also with working a “camera” to have it follow the ball.

Peach :slight_smile: [import]uid: 52491 topic_id: 24780 reply_id: 100520[/import]

Thanks, yeah I’ve been looking at that for the last hour or so but can’t make head or tail of it. There are so many .lua files! Do you know which bits in particular relate to the throwing of the ball and the camera movement?

Thanks a lot :slight_smile: [import]uid: 120751 topic_id: 24780 reply_id: 100541[/import]

Hey Alex,

I believe level1 and level2 both have the code in them for the camera movement and the throwing/shooting.

It is quite advanced code, yes - it may be worth looking at learningcorona.com to get a better understanding first or, if you can find it, seb_ly (I think that’s right) did a 30 minute video presentation about this kind of app in Corona that might be easier to follow.

OH! Found it :wink:
http://seb.ly/2011/09/angry-birds-in-30-minutes-at-update-2011/

Enjoy.

Peach :slight_smile: [import]uid: 52491 topic_id: 24780 reply_id: 100752[/import]