THATS BRILLIANT MAKE IT A GAMEAERESTRHT
Hey look man, my name's "I-smel". What I lack in smarts, I at least pay back in honesty. Boink!
Age 33, Male
England, MAN-CHESTer
Joined on 3/2/06
THATS BRILLIANT MAKE IT A GAMEAERESTRHT
hmm. my friend! Just use one big rectangle for all the range of the bullet!!
Well your friend's an absolute fucking docile bastard.
pretty realistic, definately alot more like an actual bullet than slow moving projectiles.
I'm sorry.
assuming your mans instance name is MAN, put this in the frame in which he belongs
var cosNum:Number = (Math.cos(R*(Math.PI/180)));
var sinNum:Number = (Math.sin(R*(Math.PI/180)));
function onMouseDown(){
var hit:Boolean = false;
var i:Number = 0
while(!hit && range<30){
var BP:Point = new Point(MAN._x+(i*20)*cosNum,MAN._y+(i*
20)*sinNum)
if (_root.ground.hitTest(BP.x,BP.y, true)) {
hit = true;
trace("HIT AT RANGE:"+range + " AT X POSISTION:"+BP.x+ " AND Y POSISTION:"+BP.y)
}
}
}
same code - far less CPU intensive - although there are still better ways of doing it.
Whoopsy doodle, this is AS2, so no point class
use just generic object instead
var BP:Object = new Object(....
Whoopsy doodle version 2
Man I'm failing tonight
here be the real code
var cosNum:Number = (Math.cos(R*(Math.PI/180)));
var sinNum:Number = (Math.sin(R*(Math.PI/180)));
function onMouseDown(){
var hit:Boolean = false;
var i:Number = 0
while(!hit && range<30){
var BP:Point = new Point(MAN._x+(i*20)*cosNum,MAN._y+(i*
20)*sinNum)
if (_root.ground.hitTest(BP.x,BP.y, true)) {
hit = true;
trace("HIT AT RANGE:"+i + " AT X POSISTION:"+BP.x+ " AND Y POSISTION:"+BP.y)
}
i++
}
}
That's a great thing, thanks. :DDDD
The-Red-Jack
Awesome...
*bookmarks*