__
...
♥0 |
Line 70 |
Modified 2016-12-09 09:29:42 |
MIT License
archived:2017-03-20 11:40:35
ActionScript3 source code
/**
* Copyright hemingway ( http://wonderfl.net/user/hemingway )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/AsYp
*/
package {
import flash.display.Sprite;
[SWF(frameRate=60, width=465, height=465)]
public class __prototype001 extends Sprite {
public function __prototype001() {
this.addChild(new MainView());
}
}
}
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.geom.Rectangle;
import flash.display.BitmapData;
import flash.events.Event;
import flash.events.MouseEvent;
final class MainView extends Bitmap {
public static var WIDTH:int = 465;
public static var HEIGHT:int = 465;
public static var COLOR:uint = 0x0;
private static var isMouse:Boolean = false;
private static var mousePos:Vector.<int> = new Vector.<int>(4, true);
//MOUSE_POS[0] = MOUSE_POS[1] = MOUSE_POS[2] = MOUSE_POS[3] = 0;
private var _projectile:PhysObject = new PhysObject(232, 232, 1, 0xffffff);
public function MainView() {
super(new BitmapData(WIDTH, HEIGHT, false, COLOR));
this.addEventListener(Event.ADDED_TO_STAGE, this.init_scene);
}
private function init_scene($event:Event):void {
this.removeEventListener(Event.ADDED_TO_STAGE, this.init_scene);
var $gravity:int = 1;
for (var $time:int = 1; $time++; $time<=5) {
this.bitmapData.setPixel((232 + (24*$time)), (232 + ((5+$gravity)*$time)), 0xffffff);
($gravity<7) ? $gravity++ : $gravity=$gravity;
}
}
private function enter_scene($event:Event):void {
}
private function mouse_down($event:Event):void {
mousePos[0] = stage.mouseX;
mousePos[1] = stage.mouseY;
mousePos[2] = mousePos[3] = 0;
isMouse = true;
}
private function mouse_up($event:Event):void {
isMouse = false;
}
private function mouse_move($mousePos:Vector.<int>):void {
mousePos[2] = mousePos[0];
mousePos[3] = mousePos[1];
mousePos[0] = stage.mouseX;
mousePos[1] = stage.mouseY;
}
}
class PhysObject {
private var _x:int = 0;
private var _y:int = 0;
private var _vx:int = 24;
private var _vy:int = 2;
public function PhysObject($x:int, $y:int, $size:int, $color:uint) {
this._x = $x;
this._y = $y;
}
public final function get x():int { return this._x; }
public final function get y():int { return this._y; }
public final function set x($x:int):void { this._x = $x; }
public final function set y($y:int):void { this._y = $y; }
public final function get xVelocity():int { return this._vx; }
public final function get yVelocity():int { return this._vy; }
public final function set xVelocity($vX:int):void { this._vx = $vX; }
public final function set yVelocity($vY:int):void { this._vy = $vY; }
}