HI,
I started using Corona (Game Edition) yesterday. I have setup a simple screen with a joystick and a fire button that allow me to control a sprite and shoot projectiles.
For the bullets I starting making modifications to the throwBrick() function in the Bullet example main.lua file.
Question:
-
Any suggestions on how I could make a projectile ‘pierce’ into an object when it hits it (like an arrow)?
-
Below is the throwBrick() function from the Bullet sample, I’ve only changed the display.newImage to create the brick wherever the user is. I have already written code to tell me which way the player is facing (left or right). What is the ‘best’ way to have the projectile fired to the left or right? Currently the projectile always fires to the right.
local function throwBrick()
n = n + 1
bricks[n] = display.newImage( "brick.png", player.x, player.y )
physics.addBody( bricks[n], { density= 5.0, friction= 0.3, bounce=0.00 } )
bricks[n].isBullet = true
bricks[n]:applyForce( 1200, 0, bricks[n].x, bricks[n].y )
end
Thank you for any suggestions. [import]uid: 9295 topic_id: 2180 reply_id: 302180[/import]