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

#1 2008-12-01 19:28:06

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

About detecting again....

hey evyerone i know i asked this question before, but then i read the criteria's wrong..... what  i have to make was to detect where a enemy is without using the point towards tool, and without using the x or y position of the enemy.... i know its a tough one, but then i have 1 sprite in the middle of the map that can help me, and i can also build another sprite that can roam aroudn the map so i was wondering if any of you can help me? i heard that you can use trig. to do it but how?!?!? -_-'

Offline

 

#2 2008-12-02 02:03:09

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

Re: About detecting again....

http://scratch.mit.edu/projects/Mayhem/336947

If you were to change the colour of the sensor bar so that it was red fora short distance, then orange, then yellow, then green etc you could use it to aproximate distance as well as direction.


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

 

#3 2008-12-02 13:24:07

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

Re: About detecting again....

yeha but then your firing is using the point towards tool, i'm trying to use one that dosn't use point toward but instead it uses trig. or somethign like that

Offline

 

#4 2008-12-02 13:41:28

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

Re: About detecting again....

Actually, it doesn't use "Point towards" at all.

It uses "point in direction ()" and then uses the direction of the sensor to set the direction to point in - this is quite different from "point towards"


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

 

#5 2008-12-02 14:00:42

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

Re: About detecting again....

In fact I have now updated it to use the same sprite for sensor and bullet, so no "point towards" OR "Point in direction" is used for the sensing at all!


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

 

#6 2008-12-02 19:30:02

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

Re: About detecting again....

WOW nice mayhem, but one question, what if the enemy can move? cuz the project i'm making, the enemies can move around, so is there a way where the bullet can track down its enemy? or like follows it?

Offline

 

#7 2008-12-03 09:18:43

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: About detecting again....

i guess you could think along the lines of if the enemy is to the left of the bullet it turns left and if its towards the right of the bullet it turns right? are you alowd to use a other sprite to point towards it?

Offline

 

#8 2008-12-03 19:28:31

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

Re: About detecting again....

no i'm not allowed to use another sprite to point towards it, i was reading a post about trig help and my idea is some what like that i was thinking of using the cosine law to figure out the angle at which my bullet will shoot at and it will always be aiming at the enemy so that it will always follow the enemy

Offline

 

Board footer