shot

Game Editor comments and discussion.

shot

Postby BogdansB » Mon Feb 27, 2012 2:19 pm

Hi,
How to allow an actor just to shot after 500ms?
so when you press a key and shot you need to wait 500ms.
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: shot

Postby MrJolteon » Mon Feb 27, 2012 3:55 pm

Code: Select all
EventDisable("Event Actor", EVENTKEYDOWN);
CreateTimer("Event Actor", "delay", 500);

Then in a Timer event, put
Code: Select all
EventEnable("Event Actor", EVENTKEYDOWN);
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: shot

Postby BogdansB » Mon Feb 27, 2012 5:37 pm

but that means, that my player can'T move when i press right or left :?
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: shot

Postby MrJolteon » Mon Feb 27, 2012 5:52 pm

Right... Forgot to include that
Try this then:
In the shot event, do this:
Code: Select all
if(shoot==1)
{
//shoot script here
shoot=0;
CreateTimer("Event Actor", "delay", 500);

Then, in a Timer event, put
Code: Select all
shoot=1;
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: shot

Postby BogdansB » Mon Feb 27, 2012 6:12 pm

thanks, i want to put it in Draw Actor but there are glitches idk :?

Code: Select all
char* key = GetKeyState();

if(shot>=1 && shotwait==1 && key[KEY_PAD_4]==1 )
{

CreateActor("bullet_left", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_7]==1 )
{

CreateActor("bullet_upleft", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_8]==1 )
{

CreateActor("bullet_up", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_9]==1 )
{

CreateActor("bullet_upright", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_6]==1 )
{

CreateActor("bullet", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}
else if(shot>=1 && shotwait==1 && key[KEY_PAD_3]==1 )
{

CreateActor("bullet_downright", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}
else if(shot>=1 && shotwait==1 && key[KEY_2]==1 )
{

CreateActor("bullet_down", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}
else if(shot>=1 && shotwait==1 && key[KEY_1]==1 )
{

CreateActor("bullet_downleft", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}






CreateActor("bullet_downleft", "bullet_blue.png", "(none)", "(none)", 0, 0, false);

meansthe bullet creates and I made when it creates it goes xvelocity=10;
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: shot

Postby MrJolteon » Mon Feb 27, 2012 6:18 pm

BogdansB wrote:thanks, i want to put it in Draw Actor but there are glitches idk :?

Code: Select all
char* key = GetKeyState();

if(shot>=1 && shotwait==1 && key[KEY_PAD_4]==1 )
{

CreateActor("bullet_left", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_7]==1 )
{

CreateActor("bullet_upleft", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_8]==1 )
{

CreateActor("bullet_up", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_9]==1 )
{

CreateActor("bullet_upright", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}

else if(shot>=1 && shotwait==1 && key[KEY_6]==1 )
{

CreateActor("bullet", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}
else if(shot>=1 && shotwait==1 && key[KEY_PAD_3]==1 )
{

CreateActor("bullet_downright", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}
else if(shot>=1 && shotwait==1 && key[KEY_2]==1 )
{

CreateActor("bullet_down", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}
else if(shot>=1 && shotwait==1 && key[KEY_1]==1 )
{

CreateActor("bullet_downleft", "bullet_blue.png", "(none)", "(none)", 0, 0, false);
shotwait=0;
CreateTimer("Event Actor", "shot wait", 500);


}






CreateActor("bullet_downleft", "bullet_blue.png", "(none)", "(none)", 0, 0, false);

meansthe bullet creates and I made when it creates it goes xvelocity=10;

I see... The code I posted was meant to be put in a key down event
Hey, do you have Dropbox (Or TeamViewer) btw?
Edit: Did you make the Timer event?
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: shot

Postby BogdansB » Mon Feb 27, 2012 6:27 pm

yes.

i have another question: how can i make jus one actor, the bullet wich goes up when you press [8] or down if you press [2] and so on..
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest