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

#1 2008-11-28 23:40:50

yoyoma
Scratcher
Registered: 2008-11-28
Posts: 21

i got a quesiton about detecting

hi, i have a question about somethgin in scratch. i'm buildign a game where i have to detect where the enemy is without using the point toward tool, so i was wondering, if there is another way that i can detect the enemy so that i can fire accurately at it, and that i can know wehre the enemy is and try to stay away from it, any help is appreciated thank you!

Offline

 

#2 2008-11-29 01:06:22

yoyoma
Scratcher
Registered: 2008-11-28
Posts: 21

Re: i got a quesiton about detecting

anyone? HELP!

Offline

 

#3 2008-11-29 01:58:23

yoyoma
Scratcher
Registered: 2008-11-28
Posts: 21

Re: i got a quesiton about detecting

bump

Offline

 

#4 2008-11-29 03:17:17

Kezio
Scratcher
Registered: 2008-11-26
Posts: 100+

Re: i got a quesiton about detecting

distance to sprite is your only hope and friend right now.

<when green flag clicked>
<forever>
<if><( <distance to[ obj   <>> 50 )>
Action if your distance to object is greater then 50
<end>

Last edited by Kezio (2008-11-29 03:20:28)

Offline

 

#5 2008-11-29 10:25:28

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: i got a quesiton about detecting

Why can't you use the "point towards sprite" block? There is a way, using the trig functions. I'll throw together an example project.

Last edited by fullmoon (2008-11-29 10:30:54)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#6 2008-11-29 11:06:48

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: i got a quesiton about detecting

Here it is: http://scratch.mit.edu/projects/halfbaked_fullmoon/336029


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#7 2008-11-29 11:23:38

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: i got a quesiton about detecting

You could use the "X of sprite" "Y of sprite" blocks, or a detector sprite that rotates around your main sprite like a radar.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#8 2008-11-29 19:40:19

yoyoma
Scratcher
Registered: 2008-11-28
Posts: 21

Re: i got a quesiton about detecting

thanks everyone fo your help!! ^^ XD

Offline

 

#9 2008-11-29 20:04:52

big-bang
Scratcher
Registered: 2008-02-21
Posts: 1000+

Re: i got a quesiton about detecting

yoyoma wrote:

thanks everyone fo your help!! ^^ XD

Is it a Tower Defense project? I'm working on one myself... behold my enemy script:
<when green flag clicked>
hey, no lists?! delete (all) of Add1
add (one) to Add1
<set{health}to(Add1
<go to x:(51)y:(172
<hide>   
<forever>
<if><(health<=>0)>
<hide>
<end>
<if><touching color[green
<broadcast[pwned
<end> 
<end>

<when green flag clicked>
<set{health}to(Add1
<show>
add ((<health><+>1)) to Add1
*MOVEMENT DETAILING*
<hide>

<when I receive[POW!! (hit)
<change{health}by(-1

There... phew!


http://i47.tinypic.com/6edrbm.jpghttp://i45.tinypic.com/dw9hmw.jpghttp://i50.tinypic.com/f28tvn.jpghttp://i45.tinypic.com/ruwaop.jpg

Offline

 

#10 2008-12-03 02:45:51

yoyoma
Scratcher
Registered: 2008-11-28
Posts: 21

Re: i got a quesiton about detecting

its not a tower defence project, the project that i'm making is that i build a robot or anything that uw ant it to be and that it roams around the map aiming at enimies who is constantly moving at random directions, i tried to use trig. triangulation to figure out how to do it but so far i'm still stuck.....

Offline

 

Board footer