This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » New Scratchers
  •  » Making a game? Want enemies who can follow your character? Come here!!

#1 2010-02-07 20:34:01

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Making a game? Want enemies who can follow your character? Come here!!

Here is a good script for enemies to follow your sprite.


Sprite x= any sprite
There should be a sensing bar that says "x position/y position of sprite x"
You dont need the variable to represent the sensing bar but her I couldnt find the matching sensing bar. Sorry!


<when green flag clicked>
<forever>
<glide( what ever you want )secs to x sad  <{ x }> )y sad  <{ y }> )
<end>

<when green flag clicked>
<set{ x }to( x positon of sprite x )
<set{ y }to( y position of sprite x )

Offline

 

#2 2010-02-08 05:32:53

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Making a game? Want enemies who can follow your character? Come here!!

This isn't a GOOD script, it's a very basic script that won't work in platform games.
Using the glide block is a very bad thing, because if you were on the other side of the screen, the enemy would get there as quickly as if it was right next to you. Using a point towards block with movement would give a more consistent AI, and platformer AI is a lot more complicated.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#3 2010-02-15 13:27:12

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Re: Making a game? Want enemies who can follow your character? Come here!!

What would be a better way to do this???

Offline

 

#4 2010-02-15 13:55:26

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Making a game? Want enemies who can follow your character? Come here!!

It's better, if you want that effect to do this:
<when green flag clicked>
<forever>
<point towards( you
<move( whatever amount you want )steps>
<end>

Because then you can actually run away.
If you want a platforming thing, look at archmage's AI tutorials.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#5 2010-02-15 14:24:34

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Re: Making a game? Want enemies who can follow your character? Come here!!

That script doesnt work on my version of scratch

Offline

 

#6 2010-02-15 14:25:47

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Making a game? Want enemies who can follow your character? Come here!!

That's impossible.
You do realize that by "whatever amount you want", I mean a number, right?
And that by "you", I mean whatever you want it to point to...

Right?


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#7 2010-02-15 14:31:35

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Re: Making a game? Want enemies who can follow your character? Come here!!

yes

Offline

 

#8 2010-02-15 14:33:04

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Re: Making a game? Want enemies who can follow your character? Come here!!

now it works thx

Offline

 

#9 2010-02-15 14:33:57

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Making a game? Want enemies who can follow your character? Come here!!

Then what's the problem?

Can you upload a project showing the problem?


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#10 2010-02-15 15:12:24

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Re: Making a game? Want enemies who can follow your character? Come here!!

no i fixed the problem

Offline

 

#11 2010-02-15 15:14:05

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Making a game? Want enemies who can follow your character? Come here!!

Oh, nevermind.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#12 2010-02-16 11:48:24

M4573r
Scratcher
Registered: 2010-01-31
Posts: 12

Re: Making a game? Want enemies who can follow your character? Come here!!

thx

Offline

 
  • Index
  •  » New Scratchers
  •  » Making a game? Want enemies who can follow your character? Come here!!

Board footer