Do I get an award for most demanding member?
Alright, more problems with my Gun Game. Iām trying to create a Laser, so that when a user aims, say, behind the box, the box gets the bullet hole. Hereās the script for the laser.
_root.createEmptyMovieClip(ālaserā, 1);
laser.onEnterFrame = function() {
laser.clear();
laser.lineStyle(2, 0xFF0000, 100);
laser.moveTo(guy.gunlocation.x, guy.gunlocation.y); //Gunās Location
laser.lineTo(crossair._x, crossair._y); //Crossairās Location
};
As you can see above, the laser starts at the gunās position and follows the crossair. This is the hitTest command line:
if (laser.hitTest(square)) {
hittest.text = āHIT!ā
} else {
hittest.text = āNo Hitā
}
But for some reason, this doesnāt work. Every time I shoot, no matter where the laser is, hitTest = true. I have no idea why it doesnāt work. Attached is the latest version of Gungame, with the laser. And by the way, because of the laser (for some reason) the bullet holes donāt appear. Could you guys help me out.