This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-02 23:37:18

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Help.

I would like help with enemy ai for my game.I need to find a way to make them move on their own and shoot at the everybody.

Offline

 

#2 2008-07-02 23:40:43

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

Well, if it's a scroller, you set it's X to ScrollX plus a local variable called movement (or something along those lines). Than, you change movement, and the character moves!

Offline

 

#3 2008-07-02 23:43:23

nicolasx
Scratcher
Registered: 2007-07-30
Posts: 500+

Re: Help.

Bluestribute5 wrote:

Well, if it's a scroller, you set it's X to ScrollX plus a local variable called movement (or something along those lines). Than, you change movement, and the character moves!

who are you?

Offline

 

#4 2008-07-02 23:44:16

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

nicolasx wrote:

Bluestribute5 wrote:

Well, if it's a scroller, you set it's X to ScrollX plus a local variable called movement (or something along those lines). Than, you change movement, and the character moves!

who are you?

Oh, I don't wanna mess up my 100th project, and I need to upload stuff for Scratchers United

Offline

 

#5 2008-07-02 23:45:38

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

Did you look at my game?

Offline

 

#6 2008-07-02 23:50:31

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

keroro645 wrote:

Did you look at my game?

No, something else was downloading (my computer is slower than a tortoise with 2 legs). But now I can

Offline

 

#7 2008-07-02 23:53:20

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

well look at it and then youll see that my enemies have the dumbest ai

Offline

 

#8 2008-07-02 23:58:26

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

Alright, you need to get rid of the SafeX and simply, if the distance is less than 50, point towards the character and move 1 step. If they touch gray, repeat until they aren't- change X by 1. That should do it  smile

Offline

 

#9 2008-07-03 00:05:42

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

Bluestribute5 wrote:

Alright, you need to get rid of the SafeX and simply, if the distance is less than 50, point towards the character and move 1 step. If they touch gray, repeat until they aren't- change X by 1. That should do it  smile

Could you put that in block form please cause i dont really get it.  smile

Offline

 

#10 2008-07-03 00:10:20

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

[blocks]<if><( <distance to[ character  <<> 50  )>[/blocks]
[blocks]<point towards( character[/blocks]
[blocks]<move( 1  )steps>[/blocks]
[blocks]<if><touching color[ gray[/blocks]
[blocks]<repeat until>  <not> <touching color[ gray  >>[/blocks]
[blocks]<change x by( 1[/blocks]

Offline

 

#11 2008-07-03 00:16:04

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

Bluestribute5 wrote:

[blocks]<if><( <distance to[ character  <<> 50  )>[/blocks]
[blocks]<point towards( character[/blocks]
[blocks]<move( 1  )steps>[/blocks]
[blocks]<if><touching color[ gray[/blocks]
[blocks]<repeat until>  <not> <touching color[ gray  >>[/blocks]
[blocks]<change x by( 1[/blocks]

So what does this do

Last edited by keroro645 (2008-07-03 00:16:17)

Offline

 

#12 2008-07-03 00:17:34

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

keroro645 wrote:

Bluestribute5 wrote:

[blocks]<if><( <distance to[ character  <<> 50  )>[/blocks]
[blocks]<point towards( character[/blocks]
[blocks]<move( 1  )steps>[/blocks]
[blocks]<if><touching color[ gray[/blocks]
[blocks]<repeat until>  <not> <touching color[ gray  >>[/blocks]
[blocks]<change x by( 1[/blocks]

So what does this do

If the distace is less tha n50, it will point and move towards the player. Now if it hits the wall, it will try and navigate around it (I know there are other ways. This is just the easiest)

Offline

 

#13 2008-07-03 00:20:03

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

so remove SafeX AND SafeY

Offline

 

#14 2008-07-03 00:20:53

Bluestribute5
Scratcher
Registered: 2008-07-02
Posts: 9

Re: Help.

keroro645 wrote:

so remove SafeX AND SafeY

WEll, they don't seem to help, do they? You can also set points tow guide the robots (look at JSO's Race car AI)

Offline

 

#15 2008-07-03 00:26:00

AlanProjects
Scratcher
Registered: 2008-06-23
Posts: 500+

Re: Help.

Bluestribute5???????????????????

Offline

 

#16 2008-07-03 00:26:58

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Help.

AlanProjects wrote:

Bluestribute5???????????????????

Yeah. I'm making my 100th project and I don't wanna ruin it with contest stuff


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#17 2008-07-03 00:34:36

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

So your bluestribute.

Offline

 

#18 2008-07-03 00:38:01

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Help.

keroro645 wrote:

So your bluestribute.

Yep


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#19 2008-07-03 00:38:54

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

See you Guys later!!!!!

Offline

 

#20 2008-07-04 18:03:02

hussein7860
Scratcher
Registered: 2008-07-04
Posts: 2

Re: Help.

Ok it's about my slime tennis game, for some reason, the point system keeps doubling itself, so that if you win 1 point, you win the game, i don't wan't this to happen and i can't seem to find what's causing this to happen so could somebody plzzzzz look at it and figure out what's happening (Here's a link to the project http://scratch.mit.edu/projects/hussein7860/205756) thx in advance.

Offline

 

#21 2008-07-05 13:19:14

registeel
Scratcher
Registered: 2008-04-27
Posts: 500+

Re: Help.

Bluestribute wrote:

keroro645 wrote:

So your bluestribute.

Yep

I'm registeelviruskiller

Offline

 

#22 2008-07-12 12:05:04

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help.

That script doesnt really work well.

Offline

 

Board footer