Full-Screen Control(Such As Cave Shooter)

Hello all,

I’m a novice of Corona SDK and trying to make a shooter game.

Currnetly, I thinking to make a full-screen control like as Cave shooter.

Please check the video below:

http://www.youtube.com/watch?feature=player_detailpage&v=d6EjhZZDJy4#t=67s

Like as you see above, the player ship could be controlled with dragging in any place of the screen.

Ship’s movement is belong to drag distance. If player drag long, ship will move fast.

Anyone can teach how to make that control by Corona?

Awaiting reply. Thanks

windship

I you want to move an object based on drag distance and move faster if distance is a little far then you probably looking for this.

function touchDrag(event) if event.phase == "moved" then local distance = math.sqrt(((event.x - event.xStart) ^ 2) + ((event.y - event.yStart) ^ 2)) if distance \<= 50 then 'Move Slow' else 'Move Fast' end elseif event.phase == "ended" then 'Do something if you release the press' end end Runtime:addEventListener("touch", touchDrag)

local distance = math.sqrt(((event.x - event.xStart) ^ 2) + ((event.y - event.yStart) ^ 2))

Here you will calculate the distance of the coords of your press and the current drag coords.
If you still remember your mathematics class this is called “Pythagorean Theorem” refer to this site:
http://www.purplemath.com/modules/distform.htm

 

Regards,
Prynce

I you want to move an object based on drag distance and move faster if distance is a little far then you probably looking for this.

function touchDrag(event) if event.phase == "moved" then local distance = math.sqrt(((event.x - event.xStart) ^ 2) + ((event.y - event.yStart) ^ 2)) if distance \<= 50 then 'Move Slow' else 'Move Fast' end elseif event.phase == "ended" then 'Do something if you release the press' end end Runtime:addEventListener("touch", touchDrag)

local distance = math.sqrt(((event.x - event.xStart) ^ 2) + ((event.y - event.yStart) ^ 2))

Here you will calculate the distance of the coords of your press and the current drag coords.
If you still remember your mathematics class this is called “Pythagorean Theorem” refer to this site:
http://www.purplemath.com/modules/distform.htm

 

Regards,
Prynce