all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

Shooting gallery game


Re: Shooting gallery game tralfaz
10/13/2005 4:33:13 PM
flash actionscript:
[quoted text, click to view]

Here is a test shooting game that I made once.. with mx sourcecode..
Maybe you could find something you can use.
(warning.. turn speakers down if clicking link.. loud gunshot sounds)
http://members.cox.net/4my2dogs/flash/shack/gunfight.html
tralfaz

Shooting gallery game WickedSense
10/13/2005 10:48:36 PM
I have a game with enemies scrolling inside a window. When the mouse is within
the window the cursor changes to a crosshair. When I click or "shoot" the enemy
I need the enemy to dissappear, my hittest function however is not doing
anything.

The movie is 1 frame... here is the frame actions

stop();
var mousedown;
this._lockroot = true;
var dragging = false;
watchMouse = new Object();
watchMouse.onMouseMove = function() {
if (_xmouse>=7 && _xmouse<=242.8 && _ymouse>=7 && _ymouse<=120) {
Mouse.hide();
startDrag("mycursor", true);
dragging = true;
trace("The mouse X position is "+_xmouse);
trace("The mouse Y position is "+_ymouse);
} else {
stopDrag();
dragging = false;
Mouse.show();
}
};
watchMouse.onMouseDown = function() {
mousedown = true;
};
watchMouse.onMouseUp = function() {
mousedown = false;
};
Mouse.addListener(watchMouse);

my enemies each have these actions applied to them...

onClipEvent (load) {
function reset() {
this._x = 250;
this._y = random(87);
enemySpeed = 2*(random(3)+1);
}
reset();
}
onClipEvent (enterFrame) {
this._x -= enemySpeed;
this._x -= enemySpeed;
if (this._x<-10) {
reset();
}
}

finally, my cursor has these actions

onClipEvent (enterFrame) {
this._lockroot = true;
if (mousedown == true) {
for (i=1; i<=3; i++) {
if (this.hitTest(_root["b"+i])) {
_root["b"+i].gotoAndPlay(2);

updateScore(i);
trace(_root["b"+i]._x);
updateAfterEvent();
}
}
}
}

the trace doesn't trace, so apparently my function doesn't actually run... any
ideas? thanks!

AddThis Social Bookmark Button