Discuss Scratch

PigDude21
Scratcher
2 posts

How to make NPC?

I'm making this high score game, where you have to dodge this bat flying around you, he's supposed to move in random directions, but I don't know how to make it choose random directions. BTW I already made move left, move right, move up, and move down blocks.
_x-
Scratcher
52 posts

How to make NPC?

setxtopickrandom1to4ifx=1thenmoveleft replace this code with code to move leftifx=2thenmoveright replace this code with code to move rightifx=3thenmoveup replace this code with code to move upifx=4thenmovedown replace this code with code to move down
This should work.
How it works is it picks a random number from 1 to 4, stores it in variable x, and chooses the action based on the random number
PigDude21
Scratcher
2 posts

How to make NPC?

_x- wrote:

setxtopickrandom1to4ifx=1thenmoveleft replace this code with code to move leftifx=2thenmoveright replace this code with code to move rightifx=3thenmoveup replace this code with code to move upifx=4thenmovedown replace this code with code to move down
This should work.
How it works is it picks a random number from 1 to 4, stores it in variable x, and chooses the action based on the random number

OK, thanks I use this for my other projects for other reasons too.
squashi_XD
Scratcher
2 posts

How to make NPC?

turncwdegrees
THOR_a_gamer
Scratcher
6 posts

How to make NPC?

i need to know how to make a zombie to move when the player is near and stand still when the player isn't also i have animation so if you can help me please put that into consider
GatorPlayz
Scratcher
57 posts

How to make NPC?

to _x-

it works but it goes real fast is there a way to slow it down
codeman1044
Scratcher
1000+ posts

How to make NPC?

Please don't necropost. If you need help with a script then please create your own topic.
RobinhoodGames
Scratcher
2 posts

How to make NPC?

I am making a rip off of “Mortal Kombat” how do I make one of my characters do stuff?
RobinhoodGames
Scratcher
2 posts

How to make NPC?

???
codeman1044
Scratcher
1000+ posts

How to make NPC?

Please don't necropost. If you need help with something then please create your own topic.
Iglooi
Scratcher
1 post

How to make NPC?

I'm creating a walk through shoot game where you have to protect earth by collecting asteroids. how to I code The NPC ?
deck26
Scratcher
1000+ posts

How to make NPC?

Iglooi wrote:

I'm creating a walk through shoot game where you have to protect earth by collecting asteroids. how to I code The NPC ?
Start by creating your own topic instead of necroposting please.

Last edited by deck26 (Nov. 28, 2019 15:49:41)

Powered by DjangoBB