06-27-2015, 10:13 PM
Well, I didn't account for flashy gun animations as this is a program for novices and I was attempting to keep it simple as the thread title suggests.
If I wanted to make a game with animations an weapon swaps I would likely do so in Unity where I can .addChild all day long.
Otherwise:
vehicle a dummy to the camera and the bullet to the dummy. Move the bullet backwards until it is just behind the camera.
Bullet var:canShoot boolean = false;
Gun var: isUp boolean = false;
function gunToggle; // pick a button to execute this
[
rotate gun backwards 180 degrees in respect to the dummy
if Gun.isUp = false
[Gun.isUp == true; Bullet.canShoot == true;]
else
[Gun.isUp == false;]
]
function fireGun; //pick a different button to do this ( I like Spacebar)
[
if (canShoot = true)
[ Bullet.Fire;]
else()
[ // do nothing, or firegun2, or stab w/ knife, etc.]
]
Everyone happy now?
|