Page 1 of 1

Tutorial make your actor shoot and the enemy shoot

PostPosted: Sat Jul 10, 2010 11:33 pm
by krenisis
Ok to make your actor shoot 1st we need 2 actors
your player
bullet

Now we going to make the bullet go up the screen.
Ok click on the bullet/ click add/click draw actor/click add action/ click script editor/put this code/

yvelocity=-10;

click add immediate action action


Ok now click on your player//click add // click button down// hit spacebar and (disable repeat ) //click add action // click create actor//

On the small window for create actor choose your bullet actor then click add immediate action.
Thas it we are done with your actor now you can shoot bullets when you press space key.


Now for your enemy we need 2 actors
enemy
enemy bullet

Ok 1st click the enemy bullet actor
Click on add// click on draw actor // click on script editor //
yvelocity=+10;

that make the enemy shoot down at you!!!!

Ok now click on the enemy
click on add // click on create actor // click on create timer
a small windows pops up after you give it a name on the line below it type 250 . Now the go down to the line below that and erase the * symbol type 500. Now click on and go out of that.

Now for the last part click on the enemy again
click on add // click on timer // choose the timer you just made //
now add action // create actor // choose the enemy bullet and click ok

Now run you game and the enemies will be firing at you!!! enjoy

any question please ask and someone will assist you.

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Thu Jul 22, 2010 3:20 am
by felix7991
Hello,

Thanx for the tutorial!

I was wondering if you know how to make the bullets to target your main actor?I've looked at some other peoples projects (GEForever), but am having trouble deciphering their methods and also being inexperienced with GE. Any pointers on how to implement an aimed bullet?

Cheers,
Felix

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Thu Jul 22, 2010 3:30 am
by jimmynewguy
bullet->create actor->script editor
Code: Select all
angle=direction(x,y,player.x,player.y);//change player to the name of your main actor
directional_velocity=5;//5 is the speed of the bullet

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Fri Jul 23, 2010 11:37 pm
by felix7991
Works great! Thanks for the help!

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Sat Jul 24, 2010 3:57 pm
by krenisis
Thanks jimmy I was alseep whent this question was asked. Iam glad it helped you felix , welcome to the game editor. Make sure to check out all my tutorials, they help you get a solid foot on the ground.

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Fri Sep 03, 2010 5:23 am
by zxcvbnm
Any more questions

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Fri Oct 11, 2013 10:59 am
by aamod
how can we make a projectile motion

Such as throwing a bomb at any angle,etc.

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Fri Oct 11, 2013 4:56 pm
by JaroodaGames
aamod wrote:how can we make a projectile motion

Such as throwing a bomb at any angle,etc.

Just add gravity to it;
Bomb -> Draw actor -> Script Editor
Code: Select all
yvelocity++;

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Fri Nov 29, 2013 6:13 pm
by aboukamikaz
Hey! i have a few questions concerning the shooting part of the game...
I am first wondering how can i make an ennemy shoot a bomb in an arc-like angle (first going up and left, let's say, and then slowly going down...) i tried your tip of adding gravity to it but it'd only work combined with an xvelocity code since the yvelocity is set for a gravity response... oh and i have trouble making the bullets hit the floor and explode :?
any answers would really help!!
And then,
I was wondering: how can i make my actor shoot left (when faccing left) or right (when facing right)...

Thanks for the help!!

Re: Tutorial make your actor shoot and the enemy shoot

PostPosted: Sat Nov 30, 2013 7:43 am
by skydereign
aboukamikaz wrote:I am first wondering how can i make an ennemy shoot a bomb in an arc-like angle

Set its xvelocity to whatever value, and set its yvelocity to some negative value. In the bullet's draw actor, increase yvelocity.
aboukamikaz wrote:I was wondering: how can i make my actor shoot left (when faccing left) or right (when facing right)...

For this you need to have a variable to tell which direction your actor is facing. I'm going to call it dir. On the actor's move right event, set dir equal to zero. On the actor's move right, set dir equal to one. Now in the bullet's create actor event you can do this.
Code: Select all
if(dir==0) // player was facing right
{
    xvelocity = 10; // move right
}
else // player was facing left
{
    xvelocity = -10; // move left
}