Shooting a bullet past a target till end of the screen

Hello,

I am creating a Space Shooter game.

I would like the enemy to be able to shoot a bullet at the current players position.

If the player moves out the way I would like the bullet to continue in the same path till the end of the screen.

I’ve been using transition.to for shooting straight etc…

Would anyone be able to shed light on how to do this and if it would be possible to use transition.to to achieve this.

I’ve been racking my brains trying to figure this out.

If anyone has any input I would appreciate it.

Thanks.

Try the bullet sample in the physics folder inside the Corona SDK application samples.

Hi,

Thanks for the reply.

I checked the example of the bullet flying straight. Looks like it would somehow have to calculate the angles.

I would prefer to use the transition.to, would this be possible?

Thanks.

Yes, that would be easier, but you will then need to calculate any collisions yourself, which is harder.

The transition would simply require setting the time and destination x and y of the bullet in the transition call. If your bullet needs to face in the right direction, you’ll still need to calculate the angle it faces.

Either way, it sounds like you might want to take a look at my mathlib.lua: http://code.coronalabs.com/code/mathliblua

Try the bullet sample in the physics folder inside the Corona SDK application samples.

Hi,

Thanks for the reply.

I checked the example of the bullet flying straight. Looks like it would somehow have to calculate the angles.

I would prefer to use the transition.to, would this be possible?

Thanks.

Yes, that would be easier, but you will then need to calculate any collisions yourself, which is harder.

The transition would simply require setting the time and destination x and y of the bullet in the transition call. If your bullet needs to face in the right direction, you’ll still need to calculate the angle it faces.

Either way, it sounds like you might want to take a look at my mathlib.lua: http://code.coronalabs.com/code/mathliblua