|
-
village idiot
Fully automatic weapon for game?
I know how to make a basic shoot em up game with the aimer and the people and all that good crap but I want to make one with automatic weapons. So when I click down I need an animation (for the gun) to loop and I need it to keep doing damage as its shooting. Anyone kno of a tutoiral or anything to help me with this?
This is our world now, the world of the electron and the switch. We exist without nationality, skin color, or religious bias.
-
For the animation, you could animate a gun that constantly recoils and shakes using motion tweening or something like that.
As for the scripting, you could write a function that checks if the the user has to mouse button pressed.
So maybe a mouse function like this?:
mouseObject = new Object();
mouseObject.onMouseDown = function () {
_root.userIsShooting = true;
}
mouseObject.onMouseUp = function () {
_root.userIsShooting = false;
}
Mouse.addListener(mouseObject);
Then write an onEnterFrame to check if the user is clicking, if it is then deal damage:
//declare the variables first
userIsShooting = false;
damage = 10;
onEnterFrame = function () {
if (userIsShooting) {
damage --;
}
}
-
Style Through Simplicity
You can use
Code:
if (Key.isDown(1)) {
}
to check to see if the left mouse button is down... you could then use a rollOver, or custom cursor hitTest to check for collision with the enemys.
Code:
on (rollOver) {
hitting = true
}
on (rollOut) {
hitting = false
}
onClipEvent (enterFrame) {
if (Key.isDown(1) && hitting == true) {
//hurt me
}
Not the best way ever, but it will do 
Ali
-
if (key.isdown(1)) works great. then you can have a time variable that adds and if it's greater than a certain amount it shoots if it's otherwise too fast.
-
village idiot
 Originally Posted by andross_88
For the animation, you could animate a gun that constantly recoils and shakes using motion tweening or something like that.
As for the scripting, you could write a function that checks if the the user has to mouse button pressed.
So maybe a mouse function like this?:
mouseObject = new Object();
mouseObject.onMouseDown = function () {
_root.userIsShooting = true;
}
mouseObject.onMouseUp = function () {
_root.userIsShooting = false;
}
Mouse.addListener(mouseObject);
Then write an onEnterFrame to check if the user is clicking, if it is then deal damage:
//declare the variables first
userIsShooting = false;
damage = 10;
onEnterFrame = function () {
if (userIsShooting) {
damage --;
}
}
Im a bit confused how I would add this to the movie though. When the mouse is down I need it to loop an animation.
This is our world now, the world of the electron and the switch. We exist without nationality, skin color, or religious bias.
-
Style Through Simplicity
Why not use my code then? Theres nothing wrong with andross' code, but if you don't understand it why not use a simpler option??
Ali
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|