Smart shooting Bad Guys

Game Editor comments and discussion.

Postby Sgt. Sparky » Sun Apr 22, 2007 1:59 am

make a variable called DIR, make it an actor variable not global.
put this on the draw actor event of you're enemy
Code: Select all
if(xvelocity < 0)DIR = 0;
if(xvelocity)DIR = 1;

when he is supposed to shoot,
Code: Select all
if(DIR == 1 && player.x > x) {
make him shoot;
                                                   }
if(DIR == 0 && player.x < x) {
make him shoot;
                                                   }

:D
I hope that helps. :)
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

wow

Postby d-soldier » Sun Apr 22, 2007 2:26 am

Sparky, you are on fire today! :P
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sun Apr 22, 2007 2:28 am

:D xD
I am downloading linux to the other computer so I cannot get busy coding xD
:(
Last edited by Sgt. Sparky on Thu Jun 14, 2007 6:56 pm, edited 1 time in total.
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

hmmm

Postby kyensoftware » Sun Apr 22, 2007 4:53 am

Gogo...your speed wont matter if u have 32 or 2 gb of ram...it depends on your gfx card and processor.....*starts dreaming about AMD 64-bit Dual-Core Athlon processor(...wow, its so fast......i can have 400000 fps......)*
:lol:
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby Sgt. Sparky » Sun Apr 22, 2007 5:22 am

:(
*dreams about a faster graphics proccessor...
falls over crying*
http://www.youtube.com/watch?v=lLxv38cjEDU
xD
look at that video I made xD
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

c0oL

Postby kyensoftware » Sun Apr 22, 2007 3:55 pm

COOL! nice touch!
*shoots someone and starts jumping on back*
ohh... it dosnt work...
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

---

Postby d-soldier » Sun Apr 22, 2007 4:12 pm

Hey Sparky... So I changed around different things (proccess of elimination) to determine what isnt working right... By changing on directional attack (create actor) to a rocket, and the other a laser, I was able to figure out that the script works as making the enemy shoot differently depending on what side (of him) the player is on, but is still shooting out of his back after he turns around and starts walking away... So it works to determine which side the player is on, but as far as only attacking the direction he is moving??? Ideas?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sun Apr 22, 2007 9:42 pm

I wrote:make a variable called DIR, make it an actor variable not global.
put this on the draw actor event of you're enemy
Code: Select all
if(xvelocity < 0)DIR = 0;
if(xvelocity > 0)DIR = 1;

when he is supposed to shoot,
Code: Select all
if(DIR == 1 && player.x > x) {
create the shot;
                                                   }
if(DIR == 0 && player.x < x) {
create the shot;
                                                   }

:D
I hope that helps. :)

that is the code to use xD
only I wrote it as make him shoot,
which is creating the shot,
that code has to work I used it for my spear dudes in Samurai Dude so they would not throw the spears backwards, same with the whip dude so he would not attack backwards :)
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

hmm...

Postby d-soldier » Sun Apr 22, 2007 10:56 pm

Okay, so I rechecked everything, and I think I know whats messing it up. Once the enemy finishes a path, the he changes animation (turns around)as he starts his next path.. This seems to be where all the shooting is coming from his back. How would I script the shooting direction to not be based on x-velocity, rather the animation number (and of cousse if the player is on the correct x side)?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Mon Apr 23, 2007 3:31 am

if(animpos == what you want)DIR = whatever;
but what events happen when it changes to another path?
there is not really a direct answer unless you have information(I only have 10 minutes left hurry :(!)
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 » Mon Apr 23, 2007 3:37 am

To solve the problem I may just re-render him with a walking legs, and a (parented) 180 degree rotating torso... Seems like that would be the hard way though...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Mon Apr 23, 2007 3:46 am

hmm,
make a variable called shoot. make it a global integer.
if it is just not a path finish event of any path just use on the path finish event of left,
Code: Select all
DIR = 0;
shoot = 1;

and on the path finish event of right
Code: Select all
DIR = 1;
shoot = 1;

:D
and on the draw actor event use,
Code: Select all
if(shoot == 1) {
if(DIR == 0 && player.x < x)make_him_create_missile_here;
if(DIR == 1 && player.x > x)make_him_create_missile_here;
}

:D
I hope that helps.
I will be on tomorrow(for me) :)
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

damn!

Postby d-soldier » Mon Apr 23, 2007 8:12 am

... 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?!?
Attachments
pr_help3.jpg
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: damn!

Postby Caaz Games » Mon Apr 23, 2007 8:39 am

d-soldier wrote:ThePicture thingy
That is the COOLEST game i have ever seen!
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Thanks!

Postby d-soldier » Mon Apr 23, 2007 2:15 pm

Thanks Caaz, I expect to have level1 completed and all the bugs worked out withing the week, at which time I will make a demo available for everyone to play!
BTW: Your in Fresno?! I'm in Sacramento!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

PreviousNext

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron