Player Shooting on a Platform Game
Posted: Thu Nov 18, 2010 2:06 pm
I have been a bit puzzled about shooting. Ever played Mario? Well if you have he collides with the fire flower! And he can shoot left and right........HOW?
Game Editor discussion board
http://game-editor.com/forum/
yvelocity=-10;
xvelocity=10;
xvelocity=-10;
yvelocity=-10;
yvelocity=10;
if(creator.animindex==4) // This assumes the shoot fireball animation is the fifth animation on your player
{
xvelocity=10;
}
else
{
xvelocity=-10;
}
dir = 0;
dir = 1;
switch(dir)
{
case 0:
xvelocity = 10;
break;
case 1:
xvelocity =-10;
break;
}
lcl wrote:Ok turon, here is the basic method.
First do this. Go to some script editor, click variables, click add, name the variable dir, click ok.
Then add that to player key down right script:
- Code: Select all
dir = 0;
And this to key down left:
- Code: Select all
dir = 1;
Now add this to the shot's create actor script:
- Code: Select all
switch(dir)
{
case 0:
xvelocity = 10;
break;
case 1:
xvelocity =-10;
break;
}
It is so simple.
dir=1;
dir=-1;
xvelocity=dir*10;
Bee-Ant wrote:Player -> Keydown -> Right:
- Code: Select all
dir=1;
Player -> Keydown -> Left:
- Code: Select all
dir=-1;
Shot -> CreateActor:
- Code: Select all
xvelocity=dir*10;
This is even simpler