Cannon Ball Function?

Can anybody help me make a cannon ball function where theres a cannon ball and when they touch it, it shoots ball
for example
local cannon = display.newImage(“cannon.png”)

local function shootball (event)
if event.phase = “ended” then
shoot ball.png
end
end

and i need to also have it then can change the aim of the cannon and have 3 different power levels, like green, yellow, and red with each one a different amount of force on the cannon, please msg back if u can help!!! [import]uid: 122076 topic_id: 22071 reply_id: 322071[/import]

Focus on one part at a time.

First up, you want to show the cannon and position it. Can you do that, or do you need help with it?

If you can do that, what is the next step? What is the first step you don’t quite understand? What code do you have so far, where are you struggling?

This kind of info makes it easier for others to help you without feeling like you need them to write the whole base of your app - it makes it much more likely you’ll get answers, too.

Peach :slight_smile: [import]uid: 52491 topic_id: 22071 reply_id: 87812[/import]

Well I have the cannon positioned and the ball made. What I need to do now is to make a function to allow the users to aim the cannon like move it up and down.

Once I have that made, I need to have a function to allow when the user touches the cannon, then shoot ball where cannon is aiming at this speed. [import]uid: 122076 topic_id: 22071 reply_id: 87850[/import]

OK well for aiming you’d use rotate; http://developer.anscamobile.com/forum/2011/04/20/how-rotate-turret-dragging

Unless by up and down you mean the cannon actually moves up and down? (I have seen games like this with a gun one one side of the screen.)

:slight_smile: [import]uid: 52491 topic_id: 22071 reply_id: 87998[/import]