Blazed Games

Free computer games/software
 
HomeFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Simple NPC Movement

Go down 
AuthorMessage
SageJFox

avatar

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

Character sheet
RPG: 10

PostSubject: Simple NPC Movement   Sun 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
View user profile http://www.freewebs.com/foxfiregames
Bob-1100k

avatar

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

PostSubject: Re: Simple NPC Movement   Wed 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
View user profile
santa22

avatar

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

PostSubject: answer   Wed 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
View user profile http://www.godbattles.i8.com
SageJFox

avatar

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

Character sheet
RPG: 10

PostSubject: Re: Simple NPC Movement   Wed 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
View user profile http://www.freewebs.com/foxfiregames
Bob-1100k

avatar

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

PostSubject: Re: Simple NPC Movement   Wed 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
View user profile
brett

avatar

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

PostSubject: cool   Thu Apr 03, 2008 3:12 pm

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

Posts : 106
Join date : 2008-03-23

Character sheet
RPG: 10

PostSubject: Re: Simple NPC Movement   Fri 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
View user profile http://blazedgames.forumotion.com
Sponsored content




PostSubject: Re: Simple NPC Movement   

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: