Shooting Help Please?

Game Editor comments and discussion.

Shooting Help Please?

Postby mog440 » Tue Jun 01, 2010 4:13 am

Can someone please help me with how to shoot properly? I have been trying for hours and cant work it out as I am fairly new to Game Editor.
I am working on a platform game, like the Caveman tutiorial, and my character needs to shoot (throw daggers) at enemys. I can get it to work when he shoots to the right but I cant get him to shoot left. Any (simple) help would be appreciated. Thanks in advance, mog.
mog440
 
Posts: 12
Joined: Mon May 24, 2010 11:02 am
Score: 0 Give a positive score

Re: Shooting Help Please?

Postby lcl » Tue Jun 01, 2010 12:18 pm

You can make it like this:

Select your dagger actor, or whatever you call him, and then Add Event -> Create Actor -> Script Editor
First, add variable called ShotWay, or something you want, then insert that code to the script:
Code: Select all
if(ShotWay==0)
{
    xvelocity=-5; //That makes the dagger to go to left
}
if(ShotWay==1)
{
    xvelocity=5; //That makes it to go right
}

Then, in your main character key downs add these scripts:

Add this one to key down that moves your actor to left
Code: Select all
ShotWay=0;

And this one to key down that moves your actor to right
Code: Select all
ShotWay=1;

This method allows you to shoot left and right.
If you have still any questions, ask me! :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Shooting Help Please?

Postby mog440 » Wed Jun 02, 2010 12:33 am

End of headache. THANKYOU!! Thats why I like this forum, everyone is so helpful.
Would you use something similar to change animation of the dagger so the pointy end always goes first too?
mog440
 
Posts: 12
Joined: Mon May 24, 2010 11:02 am
Score: 0 Give a positive score

Re: Shooting Help Please?

Postby mog440 » Wed Jun 02, 2010 1:05 am

I am also having trouble with player staying on horizontally moving platform. Player jumps onto platform and platform slides out from underneath him? Do I have to increase the Physical Response or something??
mog440
 
Posts: 12
Joined: Mon May 24, 2010 11:02 am
Score: 0 Give a positive score

Re: Shooting Help Please?

Postby MrJolteon » Wed Jun 02, 2010 6:53 am

Add this on collision with the moving platform:
Code: Select all
PhysicalResponse(bleh bleh);
ChangeParent("Event Actor", "x_moving_platform_actor");

and on the normal platform:
Code: Select all
PhysicalResponse(bleh bleh);
ChangeParent("Event Actor", "(none)");
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: Shooting Help Please?

Postby lcl » Wed Jun 02, 2010 5:34 pm

mog440 wrote:End of headache. THANKYOU!! Thats why I like this forum, everyone is so helpful.
Would you use something similar to change animation of the dagger so the pointy end always goes first too?

It was fun to help you! :D And that animation changing, you just must put it to change the animation in that same create actor script,
like this:

Code: Select all
if(ShotWay==0)
{
    xvelocity=-5; //That makes the dagger to go to left
    ChangeAnimation("Event Actor", "Enter here your animation of left moving dagger", FORWARD);
}
if(ShotWay==1)
{
    xvelocity=5; //That makes it to go right
    ChangeAnimation("Event Actor", "Enter here your animation of right moving dagger", FORWARD);
}


:D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest