Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Update Section
- for (i = 0; i < count; i++)
- {
- sprite = new SpriteClass();
- sprite.destX = 350 + 20*(i%4);
- sprite.destY = 350; // + 10*(int(Math.random()*4));
- sprite.x = int(Math.random() * 700);
- sprite.y = 290 + int(Math.random() * 200);
- //addChild(sprite);
- addChild(sprite.bitmapCanvas);
- sprites.push(sprite);
- }
- public function SpriteClass()
- {
- speed = 5.5;
- remainingMoveRate = speed;
- bitmapDataCanvas = new BitmapData(20, 20, true, 0x000000);
- bitmapCanvas = new Bitmap(bitmapDataCanvas);
- rectUnit = new Rectangle(0, 0, 20, 20);
- //addChild(bitmapCanvas);
- }
- public function Update():void
- {
- MoveUnit();
- //Got added to compensate for not being in the sprite class
- bitmapCanvas.x = x;
- bitmapCanvas.y = y;
- bitmapDataCanvas.lock();
- //rectUnit.x = 0;
- //rectUnit.y = 0;
- bitmapDataCanvas.fillRect(Main.rectBackground, 0x00000000);
- bitmapDataCanvas.copyPixels(Main.spriteData, rectUnit, Main.pointUnit);
- bitmapDataCanvas.unlock();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement