Page 1 of 1

How do i make my character shoot?

PostPosted: Sun May 06, 2007 10:27 pm
by AnimeTank
I figured out how to make my character move back and forth and stop, but i don't know how to make him shoot his gun. Does anyone know how to do this? If you do, please reply. It will do me some good. Thanks. :wink:

ok

PostPosted: Mon May 07, 2007 4:16 am
by d-soldier
Create an actor to be the bullet... worry about the grpahics for it later, the default pacman will be fine for now. Give it a xvelocity in it's draw actor event, and set the "CREATE AT STARTUP" to NO. Now, back to your player. Add a keydown event for whatever key you are wanting to cause the shooting, and make it create the bullet actor you just created... You will probably need to do some research on directional variables to change which direction the bullet flies depending on which way the player is facing, but a quick search of the forum (keywords) will locate those for ya.

EDIT:
The draw actor script for the bullet should be something like:
xvelocity = 10;

Re: ok

PostPosted: Wed May 09, 2007 7:25 pm
by jazz_e_bob
Yay! The definitive thread for the age old shooting question.

Just one thing though:

The create actor script for the bullet should be something like:
xvelocity = 10;

Here is a demo too :wink:

PostPosted: Wed Jul 25, 2007 7:10 am
by arcreamer
hey when i downloaded that shooting demo i looked over all the scripts and then tried to make my own using the same scripts but in Script Editor it kept coming up with errors even though i typed the same lines that were in the demo... please help

PostPosted: Wed Jul 25, 2007 7:34 am
by pixelpoop
get a better feel for it by going through the demo and altering things like, the rate of fire, the bullet sprite, the speed of the bullets and enemies, try adding another weapon selection. etc.

PostPosted: Wed Jul 25, 2007 9:33 am
by DilloDude
If you get errors with the smae code, it's most likely you haven't defined all the variables required. Click on the 'variables' button in the script editor of the window in the demo and find all the required variables, then add them in your game. Also check global code for any definitions there.

PostPosted: Wed Jul 25, 2007 3:43 pm
by Sgt. Sparky
I made a Demo that also has different gun equiping:
http://game-editor.com/forum/tp-3623-Gu ... mple-.html
:D

PostPosted: Wed Jul 25, 2007 3:58 pm
by arcreamer
sgtspraky urs is way too complicated! =(

if(sel == 0)
{
if(dir == 0)ChangeAnimation("Event Actor", "GUN_1LEFT", FORWARD);
if(dir == 1)ChangeAnimation("Event Actor", "GUN_1RIGHT", FORWARD);
}
if(sel == 1)
{
if(dir == 0)ChangeAnimation("Event Actor", "GUN_2LEFT", FORWARD);
if(dir == 1)ChangeAnimation("Event Actor", "GUN_2RIGHT", FORWARD);
} whats all that and all the other code??