The Daily Click ::. Forums ::. Klik Coding Help ::. one character following another
 

Post Reply  Post Oekaki 
 

Posted By Message

aaron_brammer



Registered
  14/05/2003
Points
  1299
11th July, 2003 at 00:43:42 -

has any one played the old ghostbusters 2 game on gameboy, or better yet any of the 2d legend of zelda games, well heres my question, how can i effectively have an npc follow me like the npcs do in zelda or gb2.

 
heyo

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
11th July, 2003 at 01:02:37 -

Lemme think. Here are a couple of ways:

If NPC is not closer than 5 pixels to player - start,look in the direction of player.

If NPC is closer than 5 pixels to player - stop.

^^^ For that you'll need bouncyball movement for the NPC.

2

Repeat while player.speed > 0 - Npc.dir = player.dir, set speed to player.speed.

-Andy

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Cobain [Mk]



Registered
  04/07/2003
Points
  12
11th July, 2003 at 01:32:03 -

yes but if my game like a dog follow my character?
How i can make it?


 
Game:Van Dussen and the chaos of Syboo [Demo]
17%
1 level Complete


aaron_brammer



Registered
  14/05/2003
Points
  1299
11th July, 2003 at 02:02:53 -

i need the second character to always be behind the other, not to the left or right or front.

 
heyo

Santa



Registered
  19/05/2003
Points
  644
11th July, 2003 at 03:35:39 -

Download snake example from my profile, then edit it a little. If you cant figure out how message me and ill help you

 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

aaron_brammer



Registered
  14/05/2003
Points
  1299
11th July, 2003 at 04:17:46 -

i have tgf

 
heyo

:JULI@N:



Registered
  14/07/2002
Points
  641
11th July, 2003 at 22:55:06 -

JonWoG, the extension you're talking about is called Third Eye Modifier object

 
n/a

aaron_brammer



Registered
  14/05/2003
Points
  1299
12th July, 2003 at 04:49:58 -

could you give me a link please, i cant find it anywhere

 
heyo

Deleted User
12th July, 2003 at 05:25:13 -

Go to the clickteam website and dowload advance tutorials for TGF you will see everything clearly that way.

 

Daniel[Crazy_Productions]

Possibly Insane

Registered
  29/12/2002
Points
  2505
12th July, 2003 at 06:33:29 -

aron just use set position!X) then it will be just like zelda

 
Beware of life ...so far noone have survived it.......

Rycon



Registered
  20/09/2002
Points
  996
14th July, 2003 at 15:11:41 -

Everybody does things there own way, heres what I just thought of:

make a active object thats invisible.

If direction of Master is right = place active object (to the left of master)

if dog is not overlaping active object, always look in direction of object.

if dog IS overlaping active object, set speed to 0.

This may not work, but it just might help.

 
We are the music makers, we are the dreamers of dreams...

NUB



Registered
  23/10/2003
Points
  95
30th October, 2003 at 12:18:12 -

If you make an invisible circular object that sets position constantly at 0,0 from your player, then set the dogs movement to bouncy ball, and tell it to always look towards player, when it collides with the circular object, tell it to stop movement.

If you want the dog to help you kill things or do anything besides following you, put the following C&E's in a group, and disable it when you want the dog to other things, and create another group of C&E's with the dogs AI when not following you, and enable that when you want him to stop following.

 
n/a

Kirby Smith

Resident Slacker

Registered
  18/05/2003
Points
  479

VIP Member360 OwnerWii OwnerThe Cake is a Lie
30th October, 2003 at 16:34:46 -

Here's how I would do it...

The primary character would need an alterable value called "var path node", and the secondary character would need an alterable value called "var find" Every second have the primary character create an object called "path node" and set it's value (let's call it "var node") equal to the "var path node" alterable value of the primary character. Now, have the following character find the nearest path node and go to it. When it gets there, set its "var find" to whatever the path node's "var node" value is. Every time this happens, have MMF destroy every path node with a "var node" value less than the "var find" value. To smooth things out, calculate the distance between the secondary character and either 2 or 3 of the next nodes (based on their "var node" variable), then have it go to the one with the shortest distance. When it gets to it, all of the skipped nodes will be destroyed so you don't have to worry about them.

This method allows teh secondary character to follow the main character through more complex levels (around walls and such). To make sure of this, you could set up invisible actives which, if collided with, would cause the main character to drop nodes at a faster rate. You could also have more fun with it, and make the secondary character a little slower than the main character. Then, when it is a set distance away, have it stop, look around, and then run after you to simulate it trying to catch up. Dunno if it would do anything for gameplay, but it might be a little more believable than having a robot following you.

 
XBL Gamertag: Rampant Mjolnir

Kirby Smith

Resident Slacker

Registered
  18/05/2003
Points
  479

VIP Member360 OwnerWii OwnerThe Cake is a Lie
30th October, 2003 at 16:40:15 -

That works in your case Hadoken, but we're really not sure how complex his game-world is going to be. I'm sure if he needed something that simple he would have already thought of it. Not knocking your technique, just saying that I think he needs it to do a little more.

 
XBL Gamertag: Rampant Mjolnir

Kirby Smith

Resident Slacker

Registered
  18/05/2003
Points
  479

VIP Member360 OwnerWii OwnerThe Cake is a Lie
30th October, 2003 at 18:03:36 -

One thing to add to mine is that you would probably want to create a sphere around your character, as others mentioned. If the secondary character overlaps it, set it up so that the primary character won't spawn nodes any more.

 
XBL Gamertag: Rampant Mjolnir
   

Post Reply



 



Advertisement

Worth A Click