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

#51 2012-04-21 15:09:09

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Detection with guards.

aegisrunestone wrote:

Okay, I'll try that.

BTW: How do you edit posts?

You can't, since you're a New Scratcher.  When you become a Scratcher, "Edit" and "Delete" links will appear next to "Quote" and "Report" on your posts.

Offline

 

#52 2012-04-21 17:05:31

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: Detection with guards.

What Greenatic said  wink

Like before post here if you have more problems or if you can't work out a fix; I'll try to get to it as soon as possible.

Offline

 

#53 2012-04-25 12:27:17

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

Okay. I'll do that. Thanks for answering for my question.  smile

I'll try working on it when I get the time.

Offline

 

#54 2012-04-25 18:49:13

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

I tried swapping it to an "or" statement instead of an "and," and while he starts to chase Ezio, he moves very slowly.

http://img805.imageshack.us/img805/2063/acguardenhanced.gif

Offline

 

#55 2012-04-26 18:48:22

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: Detection with guards.

See what you mean; just tried it...I'll see if I can get to it

EDIT: FIXED IT. SOLUTION BELOW

The problem is that your When I Receive Chase code has a forever block. Don't put forever's in broadcasts, generally - at least not for this.

Remove the bit of the code that says if distance = 0 or Dsitance to Ezio > 100 and everthing inside it.

Then take the stuff out of the forever block and put it in a repeat until block.

for the condition for the repeat until put Distance to ezio > 100.

How it should look:


when I receive [Chase v]
repeat until <(distance to [Ezio v]) > [100]>
if <touching [MazeMainLevel v]?>
move [-10] steps
wait [1] secs
end
if <<(Detected) = [1]> or <(distance to [Ezio v]) < [100]>>
point towards [Ezio v]
move [2] steps
end
end
glide [2] secs to x: [-164] y: (y position)

Note that that code isn't perfect but its a quick fix based off of the existing stuff. The only problem you might have is actually it moving too fast lol. To solve that just put a wait 0.05 secs block in the if detected = 1 section, though.

Last edited by BetaSmozzick (2012-04-26 19:03:56)

Offline

 

#56 2012-04-29 01:00:08

darthvader111
Scratcher
Registered: 2010-03-12
Posts: 45

Re: Detection with guards.

Make a distance to Ezio variable. Have a constant "when flag clicked, set Distance to Ezio (variable) to distance to Ezio (sensing block)

Then, have an if___else___ script using the variable to sense whether or not the guard detects Ezio and moves towards him.

Note: make sure Ezio's movement steps are faster and greater than the guard's so he can escape the guard's attention.

Offline

 

#57 2012-04-29 07:23:25

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: Detection with guards.

Think the stuff above is already implemented. And I can't see why you would want a distance to Ezio variable when you have the actual distance to Ezio block.

Offline

 

#58 2012-04-29 16:43:28

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Detection with guards.

aegisrunestone wrote:

I'm making a game with detection. The guards move around randomly until they detect you.

It works, except that the guard bypasses ALL the walls, and gets to you within .5 seconds; he basically blazes across the screen.

I need help. I'll show you the script I'm using for detection:

http://img4.imageshack.us/img4/4291/detectionacgame2.png
http://img854.imageshack.us/img854/9722/detectionacgame.png

Yes, I know, it's an AC game.  wink  I don't plan to sell it nor share it, I'm doing it for a class.

Offline

 

#59 2012-05-02 18:13:18

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: Detection with guards.

? Just to show the images?

Offline

 

#60 2012-05-07 10:54:39

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

BetaSmozzick wrote:

See what you mean; just tried it...I'll see if I can get to it

EDIT: FIXED IT. SOLUTION BELOW

The problem is that your When I Receive Chase code has a forever block. Don't put forever's in broadcasts, generally - at least not for this.

Remove the bit of the code that says if distance = 0 or Dsitance to Ezio > 100 and everthing inside it.

Then take the stuff out of the forever block and put it in a repeat until block.

for the condition for the repeat until put Distance to ezio > 100.

How it should look:


when I receive [Chase v]
repeat until <(distance to [Ezio v]) > [100]>
if <touching [MazeMainLevel v]?>
move [-10] steps
wait [1] secs
end
if <<(Detected) = [1]> or <(distance to [Ezio v]) < [100]>>
point towards [Ezio v]
move [2] steps
end
end
glide [2] secs to x: [-164] y: (y position)

Note that that code isn't perfect but its a quick fix based off of the existing stuff. The only problem you might have is actually it moving too fast lol. To solve that just put a wait 0.05 secs block in the if detected = 1 section, though.

That works! The only problem is when I enter a haystack and press the space bar, it activates the "Chase" broadcast. I'm not sure why this is.

http://img338.imageshack.us/img338/3007/haystackscript.gif

Note: this script is in Ezio's Sprite. For some odd reason, when I hit the space bar, it activates "chase" on the guard.

Offline

 

#61 2012-05-10 22:39:19

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

Anyone?  sad

Offline

 

#62 2012-05-10 23:11:25

bonechill
Scratcher
Registered: 2012-05-02
Posts: 500+

Re: Detection with guards.

What probably happened, was you accidentally put a script in that broadcasts stuff when you shouldn't. I've done that before. Just double check the script and make sure the space bar isn't broadcasting chase.


http://www.planetminecraft.com/files/sigs/scratch9p_693826_sig.jpg

Offline

 

#63 2012-07-02 13:20:55

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

Well, I tried checking for anything that activates "Chase," but it's only on the guard. Any suggestions?

Offline

 

#64 2012-07-29 19:44:06

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

... anyone?  hmm

Offline

 

#65 2012-07-29 20:03:05

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Detection with guards.

aegisrunestone wrote:

Update! (I wish there was an edit button)

There is an edit button. It's at the bottome of each of your posts and is between delete and quote.


http://i46.tinypic.com/35ismmc.png

Offline

 

#66 2012-07-30 10:02:55

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Detection with guards.

I'll check this out shortly; didn't know you were still having difficulties.

It's worth pointing out that aegis is a new scratcher and so cannot edit their posts.

Would it be possible for you to publish it again aegisrunestone? Not sure how up to date my version is.

Last edited by Smozzick (2012-07-30 10:04:27)


http://i50.tinypic.com/ded8m.png

Offline

 

#67 2012-07-30 10:42:57

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Detection with guards.

Is it still due? Your first post about this was 3 months ago, most school projects are due before that. Plus, it's summer. About your problem, I would check out your haystack script and see if it's there.


........................................................................................................................................................................................................................................

Offline

 

#68 2012-09-02 21:59:23

aegisrunestone
New Scratcher
Registered: 2012-04-08
Posts: 34

Re: Detection with guards.

zubblewu wrote:

Is it still due? Your first post about this was 3 months ago, most school projects are due before that. Plus, it's summer. About your problem, I would check out your haystack script and see if it's there.

Oh, I already turned it in. Me and my partner got an A because we went beyond the call of duty, so to speak.  tongue  I just want to perfect it.

Smozzick wrote:

I'll check this out shortly; didn't know you were still having difficulties.

It's worth pointing out that aegis is a new scratcher and so cannot edit their posts.

Would it be possible for you to publish it again aegisrunestone? Not sure how up to date my version is.

What do you mean "publish"? Do you mean submit to the website, or just upload it somewhere?

Offline

 

Board footer