How do i make my character shoot?

Non-platform specific questions.

How do i make my character shoot?

Postby AnimeTank » Sun May 06, 2007 10:27 pm

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:
Current Projects:

Some game about some guy... :)

Message me if you have an XboxLive account. Then send me a Friend Request to my Gamertag, AnimeTank.
Message me if you have a WoW account. Then tell me what server your on, along with your name.
User avatar
AnimeTank
 
Posts: 96
Joined: Sat May 05, 2007 10:37 pm
Location: At my House, on my computer, in my seat
Score: 13 Give a positive score

ok

Postby d-soldier » Mon May 07, 2007 4:16 am

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;
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: ok

Postby jazz_e_bob » Wed May 09, 2007 7:25 pm

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:
Attachments
shooting demo.zip
(10.48 KiB) Downloaded 135 times
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby arcreamer » Wed Jul 25, 2007 7:10 am

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
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Postby pixelpoop » Wed Jul 25, 2007 7:34 am

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.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby DilloDude » Wed Jul 25, 2007 9:33 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Sgt. Sparky » Wed Jul 25, 2007 3:43 pm

I made a Demo that also has different gun equiping:
http://game-editor.com/forum/tp-3623-Gu ... mple-.html
:D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby arcreamer » Wed Jul 25, 2007 3:58 pm

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??
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest