A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: Multi Array + Collision

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    14

    Multi Array + Collision

    I am making this maze game as a uni project, unforgivable I am a bit lost when it come to actionscript 3.

    i have attached a picture of the game.

    What i am trying to figure out is how do I get the koala to detect when it touches the TNT or the Exit MCs ?

    here is my code.
    Code:
    //{ region === initialisation
    
    const MAP_WIDTH = 16
    const MAP_HEIGHT = 11
    const TILE_WIDTH = 40
    restart_btn.visible = false;
    rescued_mc.visible = false;
    var map:Array = [
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    [1, 5, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 1], 
    [1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], 
    [1, 5, 1, 0, 1, 7, 0, 0, 0, 6, 0, 1, 0, 1, 0, 1], 
    [1, 0, 1, 0, 1, 6, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1], 
    [1, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1], 
    [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], 
    [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], 
    [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1], 
    [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], 
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
    ]
    
    var LEFT, RIGHT, UP, DOWN:Boolean = false;
    var koalas:Array = new Array()
    var TNTs:Array = new Array()
    
    
    
    var displayMap:Array = new Array();
    
    for (var row = 0; row < MAP_HEIGHT; row++){
    	displayMap[row] = new Array();
    	for (var col = 0; col < MAP_WIDTH; col++){
    		var tile:Tile = new Tile();
    		displayMap[row][col] = tile;
    		tile.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    		tile.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    		tile.visible = false;
    		addChild(tile);
    		tile.gotoAndStop(1);
    		switch (map[row][col]){
    			case 1: 
    				tile.gotoAndStop(2);
    			break;
    			case 5: 
    				var myKoala_mc:Koala = new Koala();
    				addChild(myKoala_mc);
    				myKoala_mc.addEventListener(Event.ENTER_FRAME, moveKoala);
    				myKoala_mc.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    				myKoala_mc.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    				myKoala_mc.visible = false;
    				myKoala_mc.row = row;
    				myKoala_mc.col = col;
    				koalas.push(myKoala_mc)
    			break;
    			case 6:
    			var TNT_mc:TNT = new TNT();
    				addChild(TNT_mc);
    				TNT_mc.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    				TNT_mc.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    				TNT_mc.visible = false;
    				TNT_mc.row = row;
    				TNT_mc.col = col;
    				TNTs.push(TNT_mc)
    			break;
    			case 7:
    			var exit_one:exit1 = new exit1();
    				addChild(exit_one);
    				exit_one.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    				exit_one.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    				exit_one.visible = false;
    				exit_one.row = row;
    				exit_one.col = col;
    			break;
    		}
    	}
    }
    setChildIndex(myKoala_mc, numChildren - 1);
    //} endregion initialisation ====
    // other listeners==================
    splash_mc.start_btn.addEventListener(MouseEvent.CLICK, startGame);
    restart_btn.addEventListener(MouseEvent.CLICK, reStartGame);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
    stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
    
    // Event Handlers===================
    function startGame(m:MouseEvent){
    	splash_mc.visible = false;
    	for (var row = 0; row < MAP_HEIGHT; row++){
    		for (var col = 0; col < MAP_WIDTH; col++){
    			displayMap[row][col].visible = true;
    		}
    	}
    	
    	for each (var bear in koalas) {
    		bear.visible = true;
    			for each (var deer in TNTs) {
    				deer.visible = true;
    			}
    	}
    	restart_btn.visible = true;
    	exit_one.visible = true;
    	rescued_mc.visible = true;
    }
    
    
    function reStartGame(m:MouseEvent){
    	splash_mc.visible = true;
    	for (var row = 0; row < MAP_HEIGHT; row++){
    		for (var col = 0; col < MAP_WIDTH; col++){
    			displayMap[row][col].visible = false;
    		}
    	}
    	for each (var bear in koalas) {
    		bear.visible = false;
    			for each (var deer in TNTs) {
    				deer.visible = false;
    			}
    	}
    	myKoala_mc.visible = false;
    	restart_btn.visible = false;
    	TNT_mc.visible = false;
    	exit_one.visible = false;
    	rescued_mc.visible = false;
    }
    
    //{ region moving koala
    const DIR_RIGHT = 1;
    const DIR_LEFT = -1;
    const DIR_UP = -1;
    const DIR_DOWN = 1;
    
    function moveKoala(evt:Event){
    	var temp = evt.currentTarget as Koala;
    	with (temp){
    		if (LEFT && canMoveX(temp, DIR_LEFT)){
    			moveX(temp, DIR_LEFT);
    		} else if (RIGHT && canMoveX(temp, DIR_RIGHT)){
    			moveX(temp, DIR_RIGHT);
    		} else if (UP && canMoveY(temp, DIR_UP)){
    			moveY(temp, DIR_UP);
    		} else if (DOWN && canMoveY(temp, DIR_DOWN)){
    			moveY(temp, DIR_DOWN);
    		} else {
    			gotoAndStop("stand");
    		}
    	}
    }
    
    function canMoveX(aKoala, aDirection):Boolean {
    	
    	var canMove:Boolean;
    	
    	if (map[aKoala.row][aKoala.col + aDirection] == 6 || map[aKoala.row][aKoala.col + aDirection] == 7|| map[aKoala.row][aKoala.col + aDirection] == 0)
      {
        return true;
      }
      	else return false;
    }
    
    function moveX(aKoala, aDirection){
    	with (aKoala){
    		if (aDirection == DIR_LEFT) gotoAndStop("left");
    		else gotoAndStop("right");
    		map[row][col] = 0;
    		displayMap[row][col].gotoAndStop(1);
    		col = col +aDirection;
    		map[row][col] = 5;
    		x = (col + 0.5) * TILE_WIDTH;
    	}
    }
    
    function canMoveY(aKoala, aDirection):Boolean {
    	
    	var canMove:Boolean;
    	
    	if (map[aKoala.row + aDirection][aKoala.col ] == 6 || map[aKoala.row + aDirection][aKoala.col ] == 7 || map[aKoala.row+ aDirection][aKoala.col ] == 0)
      {
        return true;
      }
      	else return false;
    }
    
    function moveY(aKoala, aDirection){
    	with (aKoala){
    		if (aDirection == DIR_UP) gotoAndStop("up");
    		else gotoAndStop("down");
    		map[row][col] = 0;
    		displayMap[row][col].gotoAndStop(1);
    		row = row + aDirection;
    		map[row][col] = 5;
    		y = (row + 1.5) * TILE_WIDTH;
    	}
    }
    
    //} endregion
    
    function keyDownHandler(k:KeyboardEvent){
    	var key = k.keyCode;
    	switch (key){
    		case Keyboard.LEFT: 
    			LEFT = true;
    			break;
    		case Keyboard.RIGHT: 
    			RIGHT = true;
    			break;
    		case Keyboard.UP: 
    			UP = true;
    			break;
    		case Keyboard.DOWN: 
    			DOWN = true;
    			break;
    	}
    }
    
    function keyUpHandler(k:KeyboardEvent){
    	var key = k.keyCode;
    	switch (key){
    		case Keyboard.LEFT: 
    			LEFT = false;
    			break;
    		case Keyboard.RIGHT: 
    			RIGHT = false;
    			break;
    		case Keyboard.UP: 
    			UP = false;
    			break;
    		case Keyboard.DOWN: 
    			DOWN = false;
    			break;
    	}
    }
    Any help would be appreciated, thank you.
    Attached Images Attached Images

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You simply need to check in moveX and moveY what the value is in the map for the target position, before you overwrite it with the koala.

    I would highly suggest that you type every single one of your variables, do not use with statements, and use constants for your special values. That is, have const TNT:int = 6; and use TNT instead of 6 when 6 means TNT. Similarly for KOALA, BLOCK, EMPTY, and EXIT

  3. #3
    Junior Member
    Join Date
    May 2011
    Posts
    14
    Could you give me an example on how to do this please ?

    thank you.

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Code:
    const EMPTY:int = 0;
    const BLOCK:int = 1;
    const KOALA:int = 5;
    const TNT:int = 6;
    const EXIT:int = 7;
    
    const MAP_WIDTH:int = 16;
    const MAP_HEIGHT:int = 11;
    const TILE_WIDTH:int = 40;
    restart_btn.visible = false;
    rescued_mc.visible = false;
    var map:Array = [
    [BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK], 
    [BLOCK, KOALA, TNT, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, BLOCK, EMPTY, EMPTY, EMPTY, TNT, EMPTY, BLOCK], 
    [BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, BLOCK, BLOCK, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK], 
    [BLOCK, KOALA, BLOCK, EMPTY, BLOCK, EXIT, EMPTY, EMPTY, EMPTY, TNT, EMPTY, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK], 
    [BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, TNT, BLOCK, BLOCK, BLOCK, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK], 
    [BLOCK, KOALA, BLOCK, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK], 
    [BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, EMPTY, BLOCK, EMPTY, BLOCK], 
    [BLOCK, EMPTY, BLOCK, EMPTY, BLOCK, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, BLOCK, EMPTY, BLOCK], 
    [BLOCK, EMPTY, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, EMPTY, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, EMPTY, BLOCK], 
    [BLOCK, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, BLOCK], 
    [BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK, BLOCK]
    ]
    
    var LEFT:Boolean;
    var RIGHT:Boolean;
    var UP:Boolean;
    var DOWN:Boolean;
    LEFT = RIGHT = UP = DOWN = false;
    
    var koalas:Array = [];
    var TNTs:Array = [];
    
    var displayMap:Array = [];
    
    for (var row:int = 0; row < MAP_HEIGHT; row++){
    	displayMap[row] = new Array();
    	for (var col:int = 0; col < MAP_WIDTH; col++){
    		var tile:Tile = new Tile();
    		displayMap[row][col] = tile;
    		tile.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    		tile.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    		tile.visible = false;
    		addChild(tile);
    		tile.gotoAndStop(1);
    		switch (map[row][col]){
    			case 1: 
    				tile.gotoAndStop(2);
    			break;
    			case 5: 
    				var myKoala_mc:Koala = new Koala();
    				addChild(myKoala_mc);
    				myKoala_mc.addEventListener(Event.ENTER_FRAME, moveKoala);
    				myKoala_mc.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    				myKoala_mc.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    				myKoala_mc.visible = false;
    				myKoala_mc.row = row;
    				myKoala_mc.col = col;
    				koalas.push(myKoala_mc)
    			break;
    			case 6:
     			        var TNT_mc:TNT = new TNT();
    				addChild(TNT_mc);
    				TNT_mc.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    				TNT_mc.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    				TNT_mc.visible = false;
    				TNT_mc.row = row;
    				TNT_mc.col = col;
    				TNTs.push(TNT_mc)
    			break;
    			case 7:
    			        var exit_one:exit1 = new exit1();
    				addChild(exit_one);
    				exit_one.x = TILE_WIDTH / 2 + (col) * TILE_WIDTH;
    				exit_one.y = TILE_WIDTH / 2 + (row + 1) * TILE_WIDTH;
    				exit_one.visible = false;
    				exit_one.row = row;
    				exit_one.col = col;
    			break;
    		}
    	}
    }
    //} endregion initialisation ====
    // other listeners==================
    splash_mc.start_btn.addEventListener(MouseEvent.CLICK, startGame);
    restart_btn.addEventListener(MouseEvent.CLICK, reStartGame);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
    stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
    
    // Event Handlers===================
    function startGame(m:MouseEvent):void{
    	splash_mc.visible = false;
    	for (var row:int = 0; row < MAP_HEIGHT; row++){
    		for (var col:int = 0; col < MAP_WIDTH; col++){
    			displayMap[row][col].visible = true;
    		}
    	}
    	
    	for each (var bear:Koala in koalas) {
    		bear.visible = true;
    		for each (var deer:TNT in TNTs) {
    			deer.visible = true;
    		}
    	}
    	restart_btn.visible = true;
    	exit_one.visible = true;
    	rescued_mc.visible = true;
    }
    
    
    function reStartGame(m:MouseEvent):void{
    	splash_mc.visible = true;
    	for (var row:int = 0; row < MAP_HEIGHT; row++){
    		for (var col:int = 0; col < MAP_WIDTH; col++){
    			displayMap[row][col].visible = false;
    		}
    	}
    	for each (var bear:Koala in koalas) {
    		bear.visible = false;
    		for each (var deer:TNT in TNTs) {
    			deer.visible = false;
    		}
    	}
    	restart_btn.visible = false;
    	exit_one.visible = false;
    	rescued_mc.visible = false;
    }
    
    //{ region moving koala
    const DIR_RIGHT = 1;
    const DIR_LEFT = -1;
    const DIR_UP = -1;
    const DIR_DOWN = 1;
    
    function moveKoala(evt:Event):void{
    	var temp:Koala = evt.currentTarget as Koala;
    	if (LEFT && canMoveX(temp, DIR_LEFT)){
    		moveX(temp, DIR_LEFT);
    	} else if (RIGHT && canMoveX(temp, DIR_RIGHT)){
    		moveX(temp, DIR_RIGHT);
    	} else if (UP && canMoveY(temp, DIR_UP)){
    		moveY(temp, DIR_UP);
    	} else if (DOWN && canMoveY(temp, DIR_DOWN)){
    		moveY(temp, DIR_DOWN);
    	} else {
    		temp.gotoAndStop("stand");
    	}
    }
    
    function canMoveX(aKoala:Koala, aDirection:int):Boolean {
    	var canMove:Boolean;
    	if (map[aKoala.row][aKoala.col + aDirection] == 6 || map[aKoala.row][aKoala.col + aDirection] == 7|| map[aKoala.row][aKoala.col + aDirection] == 0){
             return true;
            }else{
              return false;
            }
    }
    
    function moveX(aKoala:Koala, aDirection:int):void{
    	if (aDirection == DIR_LEFT){
              aKoala.gotoAndStop("left");
            }else{
              aKoala.gotoAndStop("right");
            }
            var r:int = aKoala.row;
            var c:int = aKoala.col;
            var newc:int c+aDirection;
            if(map[r][newc] == TNT){
               blowUp();
               return;
            }
            if(map[r][newc] == EXIT){
               success();
               return;
            }
    	map[r][c] = 0;
    	displayMap[r][c].gotoAndStop(1);
    	aKoala.col = newc;
    	map[r][newc] = 5;
    	aKoala.x = (newc + 0.5) * TILE_WIDTH;
    }
    
    function canMoveY(aKoala:Koala, aDirection:int):Boolean {
    	var canMove:Boolean;
    	if (map[aKoala.row + aDirection][aKoala.col ] == 6 || map[aKoala.row + aDirection][aKoala.col ] == 7 || map[aKoala.row+ aDirection][aKoala.col ] == 0) {
               return true;
            }else{
               return false;
            }
    }
    
    function moveY(aKoala:Koala, aDirection:int):void{
    	if (aDirection == DIR_UP){
              aKoala.gotoAndStop("up");
            }else{
              aKoala.gotoAndStop("down");
            }
            var r:int = aKoala.row;
            var c:int = aKoala.col;
            var newr:int = r+aDirection;
            if(map[newr][c] == TNT){
               blowUp();
               return;
            }
            if(map[newr][c] == EXIT){
               success();
               return;
            }
    	map[r][c] = 0;
    	displayMap[r][c].gotoAndStop(1);
    	aKoala.row = newr;
    	map[newr][c] = 5;
    	aKoala.y = (newr + 1.5) * TILE_WIDTH;
    }
    
    //} endregion
    
    function keyDownHandler(k:KeyboardEvent):void{
    	var key:uint = k.keyCode;
    	switch (key){
    		case Keyboard.LEFT: 
    			LEFT = true;
    			break;
    		case Keyboard.RIGHT: 
    			RIGHT = true;
    			break;
    		case Keyboard.UP: 
    			UP = true;
    			break;
    		case Keyboard.DOWN: 
    			DOWN = true;
    			break;
    	}
    }
    
    function keyUpHandler(k:KeyboardEvent):void{
    	var key:uint = k.keyCode;
    	switch (key){
    		case Keyboard.LEFT: 
    			LEFT = false;
    			break;
    		case Keyboard.RIGHT: 
    			RIGHT = false;
    			break;
    		case Keyboard.UP: 
    			UP = false;
    			break;
    		case Keyboard.DOWN: 
    			DOWN = false;
    			break;
    	}
    }
    I removed some lines where you were manipulating myKoala_mc and TNT_mc because those would only affect the last created instances. If you want to affect all koalas or all tnts, you will have to iterate over their respective arrays.

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    14
    I put the code in and i go these errors.
    1046: Type was not found or was not a compile-time constant: TNT. var TNT_mc:TNT = new TNT();
    1046: Type was not found or was not a compile-time constant: TNT.for each (var deer:TNT in TNTs) {
    1180: Call to a possibly undefined method TNT.var TNT_mc:TNT = new TNT();


    I changed the TNT to TNT1 and it worked.

    Now when i press left, my koala goes right, but when i press right nothing happens.

    Here is the fla if it makes it easier.
    http://www.2shared.com/file/1xthST-A/Game.html

  6. #6
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Part of that is my fault. I defined a TNT constant that conflicted with your TNT class. You should change the name of the constant. Maybe "BOOM".

    I didn't change anything about your direction logic.

    FLAs do not help. I have no way of opening them.

  7. #7
    Junior Member
    Join Date
    May 2011
    Posts
    14
    As i have not done yet, thank you for writing out that code for me. it is strange how the movement has now stopped working. will keep looking into why this has happened.

    edit: it was missing and "=" sign. var newc:int = c+aDirection;

    edit: now it is only letting me stand on the first TNT that is being created.
    Last edited by dead_bot13; 05-24-2011 at 05:53 PM.

  8. #8
    Junior Member
    Join Date
    May 2011
    Posts
    14
    For some reason this part of the code was stopping me from standing on top of the TNT and exit images.

    Code:
    if(map[r][newc] == BOOM){
               blowUp();
               return;
            }
            if(map[r][newc] == EXIT){
               success();
               return;
            }
    Last edited by dead_bot13; 05-25-2011 at 10:52 AM.

  9. #9
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Because that was the intent of that code. To blow up if you're trying to move onto TNT, and to call success if you've reached the exit.

  10. #10
    Junior Member
    Join Date
    May 2011
    Posts
    14
    sorry about last post i realised just before you posted that was the reason for the code.

    i would like Thank you So much for you help 5TonsOfFlax

    With the blowup and success functions would they look like this "function blowup(aKoala:koala):void{" or would it be a boolian ?

  11. #11
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    As psuedocoded, both blowup and success take no arguments and return void. But you can change the signatures however you feel like.

  12. #12
    Junior Member
    Join Date
    May 2011
    Posts
    14
    I have put
    Code:
    function blowUp(aKoala:Koala):void {
    	akoala.gotoAndStop("dead");
    }
    and left blowUp(); as set, but i get the error
    1136: Incorrect number of arguments. Expected 1. blowUp();

  13. #13
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Because blowUp expects you to pass it a Koala, but you are not passing it anything. Change the call to
    Code:
    blowUp(aKoala);

  14. #14
    Junior Member
    Join Date
    May 2011
    Posts
    14
    now i am getting 1120: Access of undefined property akoala. akoala.gotoAndStop("dead");, but aKoala is defined further up the code.

  15. #15
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    akoala is not the same as aKoala. Capitalization counts.

  16. #16
    Junior Member
    Join Date
    May 2011
    Posts
    14
    OMG thank you, such a stupid mistake I should have seen it.

  17. #17
    Junior Member
    Join Date
    May 2011
    Posts
    14
    Hi, how would I get a koala to move to a different position and disable the movement when it touches the EXIT_mc ?

    i am assuming you need to use a for loop ? but I am not sure how to.

    On the game image I am trying to move the koalas next to the rescue image, and when all three are up there the game ends. (just an over view of when i am trying to do).

  18. #18
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I'm not sure I understand your question. Each koala moves because of the moveKoala ENTER_FRAME listener that's been added to it. To get any individual koala to stop moving, just remove that listener from it.

  19. #19
    Junior Member
    Join Date
    May 2011
    Posts
    14
    for each one of the koala's that touches the EXIT, i just remove the event listener ?

  20. #20
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Yes. You can do that right in the moveX, moveY functions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center