Blazed Games
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Blazed Games

Free computer games/software
 
HomeLatest imagesSearchRegisterLog in

 

 Simple NPC Movement

Go down 
5 posters
AuthorMessage
SageJFox

SageJFox


Posts : 64
Join date : 2008-03-30
Age : 30
Location : Goodbye, Blazed Games...

Character sheet
RPG: 10

Simple NPC Movement Empty
PostSubject: Simple NPC Movement   Simple NPC Movement EmptySun Mar 30, 2008 12:59 pm

Well, I started this board so I might as well make the first topic.
I've noticed that a lot of people can't seem to get this. I don't know why. Anyway, to get this movement, you really only need one piece of code.
Step, Step
Code:
{
    if(place_snapped(argument0,argument1))speed=0;
    if(place_snapped(argument0,argument1) && floor(random(argument3))==0)motion_set(choose(0,90,180,270),argument2);
}
argument0 is the xsnap
argument1 is the ysnap
argument2 is the speed (should divide into the x and y snap)
argument3 is the chance that the movement will happen

I've tested it on different grids sizes, and it works on all of them. However, I haven't found a way to get directions 45, 135, 225, or 315 yet (they don't align for some reason). I hope it's useful.
~Sage J. Fox
Back to top Go down
http://www.freewebs.com/foxfiregames
Bob-1100k

Bob-1100k


Posts : 63
Join date : 2008-03-29
Age : 29
Location : SA, Australia

Simple NPC Movement Empty
PostSubject: Re: Simple NPC Movement   Simple NPC Movement EmptyWed Apr 02, 2008 5:29 am

It's good but I found one little thing: when it stops it starts moving again because it's on a the grid. Do you understand what I'm getting at?
Back to top Go down
santa22

santa22


Posts : 70
Join date : 2008-03-29
Age : 34
Location : unabletosaywhere

Simple NPC Movement Empty
PostSubject: answer   Simple NPC Movement EmptyWed Apr 02, 2008 3:36 pm

you could put a alarm on it so it has a second to stand.
Back to top Go down
http://www.godbattles.i8.com
SageJFox

SageJFox


Posts : 64
Join date : 2008-03-30
Age : 30
Location : Goodbye, Blazed Games...

Character sheet
RPG: 10

Simple NPC Movement Empty
PostSubject: Re: Simple NPC Movement   Simple NPC Movement EmptyWed Apr 02, 2008 5:57 pm

What are you setting argument3 to? It sets the chance that it will happen, so the lower it is, the more often it will move random. 45 goes good.
Back to top Go down
http://www.freewebs.com/foxfiregames
Bob-1100k

Bob-1100k


Posts : 63
Join date : 2008-03-29
Age : 29
Location : SA, Australia

Simple NPC Movement Empty
PostSubject: Re: Simple NPC Movement   Simple NPC Movement EmptyWed Apr 02, 2008 11:43 pm

It works well now though : D maybe it didn't work beecause I put the speed so high.
Back to top Go down
brett

brett


Posts : 42
Join date : 2008-04-01
Location : his house :P

Simple NPC Movement Empty
PostSubject: cool   Simple NPC Movement EmptyThu Apr 03, 2008 3:12 pm

very helpful.thanks(maybe now jon will think better of me) lol!
Back to top Go down
Jon
Admin
Jon


Posts : 106
Join date : 2008-03-23

Character sheet
RPG: 10

Simple NPC Movement Empty
PostSubject: Re: Simple NPC Movement   Simple NPC Movement EmptyFri Apr 04, 2008 1:16 pm

brett wrote:
very helpful.thanks(maybe now jon will think better of me) lol!
Maybe Razz.
Back to top Go down
https://blazedgames.forumotion.com
Sponsored content





Simple NPC Movement Empty
PostSubject: Re: Simple NPC Movement   Simple NPC Movement Empty

Back to top Go down
 
Simple NPC Movement
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Blazed Games :: Games :: Tutorials-
Jump to: