
12-09-2009, 08:23 AM
|
|
Registered User
|
|
Join Date: Dec 2009
Location: Yugoslavia (Serbia And Montenegro)
Posts: 2
Rep Power: 0
|
|
|
hero
does eny know how to make a hero shooting and kill enemie with this script??
 Actionscript:
onClipEvent(load){
this.stop();
s=4;
jumping=false;
b = this.getBounds(this);
function move(x,y){
h=false;
if(!_root.map.hitTest(_x+x+b.xmin,_y+y+b.ymin,true)){
if(!_root.map.hitTest(_x+x+b.xmax,_y+y+b.ymin,true)){
if(!_root.map.hitTest(_x+x+b.xmin,_y+y+b.ymax,true)){
if(!_root.map.hitTest(_x+x+b.xmax,_y+y+b.ymax,true)){
_x += x;
_y += y;
h=true;
}
}
}
}
return h;
}
}
onClipEvent(enterFrame){
if (_root.playGame) {
falling = move(0,s);
if(Key.isDown(Key.SPACE) && !falling && !jumping){ jumping = true; vel = -12;_root.jumpSound.gotoAndPlay(2);_root.hero.gotoAndPlay(4);}
if(Key.isDown(Key.LEFT)) {move(-s,0); this.gotoAndStop(2); this.sonic.play();}
if(Key.isDown(Key.RIGHT)) {move(s,0); this.gotoAndStop(1); this.sonic.play();}
if(jumping) {
if(vel <= 12){
h = move(0,vel-s);
if(h == false && vel < 0){ vel *= -1;}
vel++;
}
else{
jumping = false;
}
}
}
}
onClipEvent (keyUp) {this.sonic.gotoAndStop(1);}
|