Hi all, so as I’m learning how to code, I’ve went through some tutorials but am stuck on a little part(s).
So my game so far looks roughly like this: (The square is rotating constantly)
My code is as follows:
display.setStatusBar(display.HiddenStatusBar) local background = display.newImage("bg.png") local square = display.newImage( "maze.png" ) local cannon = display.newImage( "cannon.png") local physics = require('physics') physics.start() physics.setGravity(0, 0) cannon.xScale = 0.3 cannon.yScale = 0.3 cannon.x = -625 cannon.y = 1150 background.x = display.contentCentaerX background.y = display.contentCenterY background.xScale = 2 background.yScale = 2 square.x = 800 square.y = display.contentCenterY square.xScale = 2 square.yScale = 2 local function animate( event ) square.rotation = square.rotation + 1 end Runtime:addEventListener( "enterFrame", animate );
I’m trying to figure out how exactly can I make (cannonball.png) shoot out of the cannon on touch;
It could be in a fixed direction, or if possible wherever the user clicks.
Any assistance is appreciated,
Ali.