Smart shooting Bad Guys

Game Editor comments and discussion.

Re: damn!

Postby Sgt. Sparky » Tue Apr 24, 2007 3:40 am

d-soldier wrote:... So I re-rendered my walker... For some reason I cant even get the new version to do what I want... The rotating top piece is parented to the legs, and should rotate around and follow the player (tried both 180 and 360 angles for this)... Anyone?!?

if the top piece has 2 animations(left and right)
and each animation is 1 frame, use this code on its draw actor event,
Code: Select all
if(player.x < x)ChangeAnimation("Event Actor", "your_animation_for_left", FORWARD);
if(player.x >= x)ChangeAnimation("Event Actor", "your_animation_for_right", FORWARD);

: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 d-soldier » Tue Apr 24, 2007 7:35 am

Man... figured it out, I was saying "animpos" when my brain was thinking "animindex" ... man I was getting frustrated... anyway, for anyone else reading this to accomplish the same goal here. It's:

(In the enemy draw actor script: In this case animindex0 is the animated enemy walking right, and animindex1 is him walking left.)

if(animindex == 0 )dir = 0;
if(animindex == 1 )dir = 1;

(This in the event that causes the enemy to shoot, in this case a timer)

if(dir == 0 && player.x > x) {
CreateActor("Rocket", "Rocket360", "(none)", "(none)", 25, -42, false);;
}
if(dir == 1 && player.x < x) {
CreateActor("Rocket", "Rocket360", "(none)", "(none)", -25, -42, false);;

}
Thanks Sparky
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Tue Apr 24, 2007 4:14 pm

you're welcome. :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 Game A Gogo » Tue Apr 24, 2007 11:59 pm

Code: Select all
if(animindex == 0 )dir = 0;
if(animindex == 1 )dir = 1;


Can be replaced by

Code: Select all
dir=animindex;
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Wed Apr 25, 2007 1:23 am

Yes, xD
I orrigonally gave him the code so he could use it with velocity then
it got switched it around to animindex. :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

Previous

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest