Actionscript notepad.(c)Dnatoxic@gmail.com/www.dnat oxic.newgrounds.com
Collision box goto next frame.------------------------------
onClipEvent(enterFrame){
if(this.hitTest(_root.secondObj)){
_root.nextFrame()
}
}
--------------------------------------
-----------------------
Insatcne blockades.
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
_root.man._x -= 5;
}
}
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------
barrier right.
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
_root.man._x -= 5;
}
}
Make movieclip of a wall or somthing that can block another instance.Then on the walls action paste the code above.
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
------------------------------
Barrier left.
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
_root.man._x += 5;
}
}
Same instrcutions as b-right above.
--------------------------------------
-----------------------------------
Barrier bottom.
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
_root.man._y -= 5;
}
}
--------------------------------------
-----------------------------------
Barrier top
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
_root.man._y += 5;
}
}
_________________
Make a shooting movieclip play with this actionscript.
onClipEvent (mouseDown) {
play();
}
--------------------------------------
------------------------------
Movieclip play wihle moving with arrow keys.
onClipEvent (load){movespeed = 5;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
play();
_rotation = 90;
_x+= movespeed;
}
if (Key.isDown(Key.LEFT)) {
play();
_rotation = 270;
_x-= movespeed;
}
if (Key.isDown(Key.UP)) {
play();
_rotation = 0;
_y-= movespeed;
}
if (Key.isDown(Key.DOWN)) {
play();
_rotation = 180;
_y+= movespeed;
}
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
_rotation = 45;
}
if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
_rotation = 315;
}
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
_rotation = 135;
}
if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
_rotation = 225;
}
}
--------------------------------------
--------------------------------------
-------------------------------------
make movieclip follow along with mouse.
function convert(radians:Number):Number {
degrees = radians*(180/Math.PI);
return degrees;
}
man.onEnterFrame = function() {
var adjacent:Number = this._x-_xmouse;
var opposite:Number = this._y-_ymouse;
var angle:Number = Math.atan2(opposite, adjacent);
this._rotation = convert(angle);
};
-------------make movieclip move with w,a,s,d------------------------
onClipEvent(enterFrame){
if(Key.isDown(65)){
this._rotation = 270;
this._x -= 3;
; }else if(Key.isDown(68)){
this._rotation = 90;
this._x += 3;
}else if(Key.isDown(87)){
this._y -= 3;
this._rotation = 0;
}else if(Key.isDown(83)){
this._y += 3;
this._rotation = 180;
}else{
this.gotoAndStop(1);
}
}
-----------Make all sounds stop------------
stopAllSounds();