enemys walking off the edge...

Non-platform specific questions.

enemys walking off the edge...

Postby pizbi » Wed Jul 21, 2010 5:39 am

how do I make an enemy turn around before it falls of a edge? :?
User avatar
pizbi
 
Posts: 37
Joined: Thu Jul 08, 2010 3:36 am
Location: oregon
Score: 7 Give a positive score

Re: enemys walking off the edge...

Postby Hblade » Wed Jul 21, 2010 6:19 am

I was also wondering the same thing :o
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: enemys walking off the edge...

Postby savvy » Wed Jul 21, 2010 7:34 am

you could try putting little canvas' on the edges so that when the enemy touches them it turns around.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: enemys walking off the edge...

Postby Hblade » Wed Jul 21, 2010 10:06 am

oh good idea :D Or a filled region to prevent lag :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: enemys walking off the edge...

Postby Game A Gogo » Wed Jul 21, 2010 11:53 am

Code: Select all
if(CollisionFree("Event Actor",x,y+2)==0)
{
    //Turn around script here, Here's what it could be?
    ChangeAnimation(///);
    xvelocitty=-xvelocity;
}


Hope this helps :)
This might not work all the time; if there are actor that do not have the Collision State set to Disable (It's a function) and goes under the character, well it'll turn around as well
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

Re: enemys walking off the edge...

Postby pizbi » Wed Jul 21, 2010 2:50 pm

thank you thank you! :D
User avatar
pizbi
 
Posts: 37
Joined: Thu Jul 08, 2010 3:36 am
Location: oregon
Score: 7 Give a positive score

Re: enemys walking off the edge...

Postby Game A Gogo » Wed Jul 21, 2010 3:14 pm

if you want the enemy to change sides also when he encounters an objects on the left/right (So he doesn't hit them)
simply change the line
Code: Select all
if(CollisionFree("Event Actor",x,y+2)==0)
to
Code: Select all
if(CollisionFree("Event Actor",x,y+2)==0||CollisionFree("Event Actor",x-2,y)==0||CollisionFree("Event Actor",x+2,y)==0)

Just trowing this in :)
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

Re: enemys walking off the edge...

Postby jimmynewguy » Wed Jul 21, 2010 3:35 pm

Sgt. Sparky was a genius. viewtopic.php?f=6&t=3600
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: enemys walking off the edge...

Postby Hblade » Wed Jul 21, 2010 5:43 pm

He was.. one of the smartest kids I known
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: enemys walking off the edge...

Postby krenisis » Thu Jul 22, 2010 1:35 am

Wow jimmy 2006? how long you been here? jimmytheoldguy lol!!
Tutorial Database for all beginners click this link
viewtopic.php?f=4&t=8680
krenisis
 
Posts: 606
Joined: Sat Jul 25, 2009 3:27 pm
Score: 51 Give a positive score

Re: enemys walking off the edge...

Postby jimmynewguy » Thu Jul 22, 2010 3:19 am

i used GE for about 6 months before i joined the forum so almost 4 years actually :lol:
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: enemys walking off the edge...

Postby Hblade » Thu Jul 22, 2010 8:08 am

:D same here :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: enemys walking off the edge...

Postby DST » Thu Jul 22, 2010 9:25 am

Filled regions aren't a good idea for doing this because you will have to place them on every single platform that is to have an enemy on it.

Then, editing your game becomes much much slower. You'll find you have to change platform positions for all sorts of reasons to make your levels challenging yet playable.

One thing you can do is with a cloned platform, is collision>topside>platform>repeat no>
int twidth=(collide.width/2)-(width/2);
xlimit1=collide.x-twidth;
xlimit2=collide.x+twidth;

Then in enemy>draw actor>, just have the enemy walk between the two points.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: enemys walking off the edge...

Postby pizbi » Fri Jul 23, 2010 2:38 am

DST wrote:Then in enemy>draw actor>, just have the enemy walk between the two points.

how?
User avatar
pizbi
 
Posts: 37
Joined: Thu Jul 08, 2010 3:36 am
Location: oregon
Score: 7 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest