ActionScript-Code
ActionScript-Code aus mitgelieferten Beispielen
Button03
getURL("www.liveswif.com");
Button05
getURL("http://www.liatro.com/lmember/liveswif.exe");
Script - Attach Movie
getURL("www.liveswif.com");
sprite.attachMovie("light","l0",1);
sprite["l0"].removeMovieClip();
Script - duplicateMovieClip
count = 1;
while (count<20) {
_root.box.duplicateMovieClip("boxx"+count, count);
_root["boxx"+count]._x = random(350);
_root["boxx"+count]._y = random(350);
_root["boxx"+count]._xscale = random(150)+2;
_root["boxx"+count]._yscale = random(150)+2;
_root["boxx"+count]._alpha = random(100);
count += 1;
}
Script - AttachSound
s = new Sound();
s.attachSound("chimes");
s.start();
hittest
if (this.hitTest(_root.player)) {
stop();
}
preloader
stop();
percent = _root.getBytesLoaded()/_root.getBytesTotal()*100;
this.gotoAndPlay(percent);
if (percent == 100)
{
_root.gotoAndPlay(2);
}
game
stop();
if(Key.isDown(Key.SPACE))
{
_root.gotoAndPlay(2);
}
vforce = 80;
hforce = 10;
horizontal = 0;
vertical = 5;
friction = 0.9;
gravity = 0.5;
accel = 1.7;
rising = false;
falling = true;
lastX = _x;
lastY = _y;
platform = null;
//
function hitPlatforms () {
var i, y, x;
if (falling){
for (i=0; i<_root.maxPlatforms; i++) {
platform = eval("_root.platform"+i);
if(platform.hitTest(_root.player)){
_y = platform._y;
falling = false;
vertical = 0;
return;
}
}
}
platform = null;
return;
}
//
function render () {
var x, y;
x = y=0;
//
if (Key.isDown(Key.RIGHT) == true) {
x = hforce;
}
if (Key.isDown(Key.LEFT) == true) {
x = hforce*-1;
}
// Horizontal movement
if (Math.abs(horizontal)<Math.abs(x)) {
horizontal = x;
} else {
horizontal = horizontal*friction;
if (Math.abs(horizontal)<1) {
horizontal = 0;
}
}
// Up key (only allowed when not bouncing)
if (vertical == 0 && Key.isDown(Key.UP) == true) {
vertical = vforce*-1;
horizontal = horizontal;//+platform.velocity;
platform = null;
rising = true;
}
// ball is travelling upward
if (rising == true) {
vertical = vertical*gravity;
if (Math.abs(vertical)<1) {
vertical = Math.abs(vertical);
falling = true;
rising = false;
}
}
// ball is travelling downward
if (falling == true) {
vertical = vertical*accel;
hitPlatforms();
}
//
lastX = _x;
lastY = _y;
//
_x = _x+horizontal;//+platform.velocity;
if(vertical>this._height)
vertical = this._height;
_y = _y+vertical;
//
if(_x<(-_root._width/2+_width/2))
_x =(-_root._width/2+_width/2);
if(_x>(_root._width/2-_width/2))
_x = _root._width/2-_width/2;
if ( platform.hitTest(_root.player)==false) {
vertical = 2;
falling = true;
}
}
stop ();
LiveSwif Banner
stop();