space invaders

Talk about making games.

space invaders

Postby Behdadsoft » Fri Jan 08, 2010 7:58 pm

I want make a game similar to space invaders , But When I add shooting for ship don't act. I did many times before by use of the Tutorial but I didn't Successed. Please Guide Me
THANK A LOT
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: space invaders

Postby Superbeni » Fri Jan 08, 2010 8:24 pm

One shot per key down or shooting until key is released?

The first version is easy:
make a key down event, add the key(s) to press for shooting, repeat: disabled and then select script editor.
Put this into the script:
Code: Select all
CreateActor("shot", "animation", "(none)", "(none)", 0, 0, false);

This create a shot every time you press the key.

If you want to shoot until the key is released, there are two ways: a timer or controlling it in the scrip.

The timer is better for the performance.

You put this instead of the other script:
Code: Select all
CreateTimer("Event Actor", "name", 30);


Add an timer event and put the first code in the script edtior.
This will create a shot every 30 frames, with 30 fps is this one shot per second.

The other way is a bit more complicating:
make a key down event, add the key(s) to press for shooting, repeat: enabled and then select script editor.
put this in it:
Code: Select all
x = x + 1;
if(x == 30)
{
CreateActor("shot", "animation", "(none)", "(none)", 0, 0, false);
x = 0;
}

This should also create the shot every second, because the variable (x) is increased every frame, the shot is created in every 30th frame.

Both ways should work, but i didn´t test it.
I hope i could help.
User avatar
Superbeni
 
Posts: 130
Joined: Sun Aug 02, 2009 1:23 pm
Location: Vienna, Austria
Score: 31 Give a positive score

Re: space invaders

Postby thunderios » Sat Jan 09, 2010 11:14 am

Or instead of 30 you can have a variable "FireRate" in case you want more than one type of ammo.
May I ask what you mean with "When I add shooting for ship don't act"? Does it mean the ship doesn't move? Or that the bullet isn't created? Something else?
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

Re: space invaders

Postby Behdadsoft » Sat Jan 09, 2010 3:07 pm

when add key down for shoot don't work it.
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: space invaders

Postby j2graves » Sat Jan 09, 2010 4:51 pm

have you given the bullet actor a motion action?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: space invaders

Postby Scorpion50o1 » Sun Jan 10, 2010 5:25 am

for bullet did you put Create Actor > Script Editor > yvelocity = yvelocity - 5;
OMG IM SO BORED <(^^)> (>^^)> (>^^)>
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature.
User avatar
Scorpion50o1
 
Posts: 246
Joined: Fri Apr 17, 2009 1:07 am
Location: TX
Score: 8 Give a positive score

Re: space invaders

Postby Behdadsoft » Sun Jan 10, 2010 7:07 am

Hi. I did everything that you told me,but the player still can't shoot.I'll send you my created file for you,please check it and find the problem,because I become confused and I don't know what should I do.Thanks a lot.
Attachments
Space invaders.rar
project
(1.01 KiB) Downloaded 104 times
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: space invaders

Postby skydereign » Sun Jan 10, 2010 7:18 am

You need to include the data folder when posting your game, otherwise we can't run it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: space invaders

Postby Behdadsoft » Sun Jan 10, 2010 8:56 am

OK.
Attachments
data.rar
(278.77 KiB) Downloaded 85 times
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: space invaders

Postby skydereign » Sun Jan 10, 2010 9:14 am

You mean like this? If so, what you needed to do was add a keydown event for your ship that created the bullet actor. You already had the create actor event for the bullet setting the speed, but you did not actually have an event that would create the bullet.
Attachments
space.zip
(1.69 KiB) Downloaded 94 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: space invaders

Postby j2graves » Sun Jan 10, 2010 11:07 am

and make sure that 'create at startup' is set to 'no' on the bullet actor, that way it will only be created when you need it.
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: space invaders

Postby Behdadsoft » Sun Jan 10, 2010 12:16 pm

OK. Thank you Very much.
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: space invaders

Postby Behdadsoft » Mon Jan 11, 2010 1:22 pm

Hi.My ship fire from center,I want to fire from left and right side too.What should I do?
Attachments
1.rar
(2.28 KiB) Downloaded 78 times
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: space invaders

Postby thunderios » Mon Jan 11, 2010 3:40 pm

You'll have to set the position half the width of the ship to the left and to the right (x = 20 and x = -20, if the ship is 40 pixels wide).
Or, if you are using the Script Editor, type:
Code: Select all
CreateActor("Bullet", "Bullet", "(none)", "(none)", .5*width, 0, false);
and replace .5*width with -.5*width for the left bullet.
Last edited by thunderios on Tue Jan 12, 2010 2:50 pm, edited 1 time in total.
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

Re: space invaders

Postby Behdadsoft » Fri Jan 15, 2010 10:00 am

Ok.Thanks
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron