The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 ViewsonClipEvent (load) {
spd = 1;//Set enemy speed
}
onClipEvent (enterFrame) {
if (this.hitTest(_parent._bullet)) {
enemyMovieClip.removeMovieClip();
}
}
onClipEvent (enterFrame) {
if (this.hitTest(_parent.wall)) {
spd = 0;
} else {
spd = 1;
}
}
onClipEvent (enterFrame) {
//Rotate enemy to face player
Xdiff = _parent.gun._x-_x;
Ydiff = _parent.gun._y-_y;
radAngle = Math.atan2(Ydiff, Xdiff);
_rotation = int((radAngle*360/(2*Math.PI))+90);
updateAfterEvent();
if (this.hitTest(_parent.gun)) {
//Do attack
} else {
//Move
if (_rotation>180) {
_y += (spd*Math.cos(Math.PI/180*_rotation));
_x -= (spd*Math.sin(Math.PI/180*_rotation));
} else {
_y -= (spd*Math.cos(Math.PI/180*_rotation));
_x += (spd*Math.sin(Math.PI/180*_rotation));
}
}
}
Here is the code on my enemy movieclip.
So I have my enemy movie clip and I have it set up to recognize a hit test for my bullet mc. What do I put for the function of the hit test to make the enemy movieclip destroy itself?
I know of the Destroyobject? But I don't know how I would implement it to destroy self.
Hello, sorry if this is too nooby of a question.
I want to make a moveclip with 4 way movement that shoots in the direction its facing, boxhead would be an ideal example all though that is 8-way.
I've been going through the NS:Main (read all of the beginners so far), I'm using the healthbars, preloaders, enemies, etc.
I'm trying to combine them all to make a small game so I can teach myself.
I have been searching on my own for days now trying to find out how to make enemies attack in waves. So far I have found one tutorial on how to make waves in a tower defense game, but I didn't quite understand it.
I want to learn how to make waves like in the last stand, or bunny invasion.
If anybody can point me in the right direction that would be great. I prefer tutorials that explain the actionscript so that I learn, but copy and paste will work if that is all that there is.
Thanks!
At 3/31/09 12:52 AM, JnDproductions2008 wrote: you put the stop thing in the frame and actionscript in the movie clip
Haha my bad, I meant where in my script specifically to I place that, I know it goes on the MC, I shouldve been more specific.
At 3/30/09 11:34 PM, ZadeFireLance wrote: try placing it like this, it should work with your code.
if (_root.ground.hitTest(_x, _y-_height-15, true)) {
grav = 1;
}
}
onClipEvent(keyUp){
this.gotoAndStop(1);
}
Sorry to be a complete noob, but where exactly do I insert this code?
Already tried putting stop on every frame, just the first, second, and third. I think I have a similar code...
Here is whats on my character:
onClipEvent (load) {
var grav:Number = 0;
// gravity
var speed:Number = 10;
// how fast you walk
var jumpHeight:Number = 15;
// how high you jump
var slow:Number = .7;
// sets water falling speed
var slowspd:Number = speed/1.5;
// sets water walking speed
var setspeed:Number = speed;
var scale:Number = _xscale;
var ex:Number = 5;
// makes hitTests better, change for a closer hitTest (warning, more buggy if smalle, less real if further)
this.gotoAndStop(2);
}
onClipEvent (enterFrame) {
grav++;
_y += grav;
while (_root.ground.hitTest(_x, _y, true)) {
_y--;
grav = 0;
}
if (_root.water.hitTest(_x, _y, true)) {
if (grav>0) {
grav *= slow;
}
speed = slowspd;
} else {
speed = setspeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
_xscale = scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else if (Key.isDown(Key.LEFT)) {
_x -= speed;
_xscale = -scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else {
if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) {
this.gotoAndStop(3);
}
}
if (Key.isDown(Key.DOWN) && !Key.isDown(Key.UP) && Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT)) {
this.gotoAndStop(5);
}
if (Key.isDown(73) && !Key.isDown(Key.UP) && !Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(79)) {
this.gotoAndStop(4);
}
if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) {
grav = -jumpHeight;
_y -= 4;
this.gotoAndStop(2);
}
if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) {
_x -= speed;
}
if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) {
_x += speed;
}
if (_root.ground.hitTest(_x, _y-_height-15, true)) {
grav = 1;
}
}
At 3/30/09 10:37 PM, DawnOfDusk wrote: Check you crouching animation to see if there is a "stop();" on the first or second frame of that mini MC.
Nope, I already tried this, but I just now tried it again to double check. I tried it within the crouching MC and also within the MC that contains all the MC, still no luck.
Ok so I posted this earlier but realized the link was dead and figured I shouldn't revive a dead post, so here I am with a new link.
Here is an FLA, the code is partly me but ultimately from disastamaans tutorial(on the kongregate website) for basic platforming. I'm just trying to learn right now(mostly from AS:Main, link me to other sites if you know any useful ones).
So I have a MC character and have him moving with the arrows. Now there are multiple(5) frames inside of this MC. Walk Animation(which is the first frame in the MC), Standing Animation, etc. So when I hit left arrow he walks and the walk animation cycles. BUT!!! When I crouch, etc. It doesn't loop the animation it just sits on a still image (as if I did not have an animation on that frame). What am I doing wrong?
Sorry to double post:
But I have tested all the MC's on all the frames, and they all work on the first 3 frames but none other.
I did click the button, it just didn't work, sorry
Good Idea but it didn't work javascript:MakeSmileySelection(14);
So I have a MC character and have him moving with the arrows. Now there are multiple(5) frames inside of this MC. Walk Animation(which is the first frame in the MC), Standing Animation, etc. So when I hit left arrow he walks and the walk animation cycles. BUT!!! When I crouch, etc. It doesn't loop the animation it just sits on a still image (as if I did not have an animation on that frame). What am I doing wrong?
The code i'm using after my if statement is gotoAndStop(frame)
Within each MC there are more MC's and so on, I don't know if this screws with it.
Here is an FLA, the code is partly me but ultimately from disastamaans tutorial(on the kongregate website) for basic platforming. I'm just trying to learn right now(I finally made it through the beginner section of AS:Main!).
http://spamtheweb.com/ul/upload/270309/4 5314_Platform_Good.fla
Forgot to add that currently I have a total of five frames.
1 Animated-walk
2 Animated-stand
3 Animated-jump
4 Animated-crouch
5 Animated-crouch walk
Those are my five frames, and 1,2, and 3 work fine, only 4 and 5 won't animate?
And I can send anyone a link to the tutorial I used if anybody likes.