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
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.
Offline
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"
Offline
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!
Offline
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
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