Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Block = Asuka
- //Ball = Bunny
- //Ballz = Bunz
- //Bunny is linked in library
- import flash.events.Event;
- var intervalBunny = setInterval(addBunny, 1000);
- var bunz: Array = [];
- function addBunny() {
- var bunny: Bunny = new Bunny();
- bunny.x = Math.ceil(Math.random() * 500);
- bunny.y = -50;
- addChild(bunny);
- bunz.push(bunny);
- bunny.addEventListener(Event.ENTER_FRAME, dropBunny);
- }
- function dropBunny(e: Event) {
- var b: Bunny = Bunny(e.target);
- b.y += 10;
- if (b.y > 400) {
- eliminatebunz(b);
- }
- }
- stage.addEventListener(Event.ENTER_FRAME, moveAsuka);
- function moveAsuka(e: Event) {
- Asuka.x = mouseX;
- for (var i: int = 0; i < bunz.length; i++) {
- trace(i);
- if (Asuka.hitTestObject(bunz[i])) {
- eliminatebunz(bunz[i]);
- //points
- }
- }
- }
- function eliminatebunz(p) {
- p.removeEventListener(Event.ENTER_FRAME, dropBunny);
- removeChild(p);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement