# Recent posts by BartAS3 on Kongregate

 Topic: Game Programming / arrays Is there anyway in actionscript 3 to check if an Array exists? I tried.. var myArray:Array if(myArray != undefined){ do this }else{ do that } but is doesn’t seem to work.. ideas…anyone??? Problem is solved. It was a floodfill on tile movieclips. Hello, Anyone who can help me solve a problem in a actionscript 3.0 experiment that uses this algorithm? If you do then i will submit my code and experiment here. Topic: Game Programming / Tilebreaker My problem for creating a tile breaking game is to move tiles with a smooth animation. Check for each tile if it can move down and its within the array. ```private function canMove(r:int,c:int) { if (GameField[r] == null) { return -1 } if (GameField[r][c] == null) { return -1; } if (GameField[r+1][c] == 0) { return GameField[r][c]; } } ``` This function updates positions in array en move tiles in correct place. ```private function checkRemainingTiles(event:Event) { for(var a:int = 0 ; a 0) { if (GameField[i][j] == 0 && GameField[i – 1][j] > 0) { var currentTile = TileContainer.getChildByName((i-1) + “,” + j) TweenLite.to(currentTile ,.2,{ease:Linear.easeOut,y:currentTile.y + SIZE}) //TileContainer.getChildByName((i-1) + “,” + j).y += SIZE; TileContainer.getChildByName((i-1) + “,” + j).name = i + “,” + j; GameField[i][j] = GameField[i – 1][j]; GameField[i – 1][j] = 0; } } } } } demo running at: http://users.telenet.be/myflashgames/ does anyone understand why my tiles arent completely moving down or dont fit in the correct position? Like this? for(var j:int = 0 ; j < 15 ; j++) { var object = clipcontainer.getChildByName("object"+j) TweenLite.to(object,1,{x:object.x + 50, alpha:2, rotation:45,delay:2, onComplete:clipcontainer.removeChild, onCompleteParams:[object]}); } hi there, I want to use tweenlite in a game. for experimenting with tweenlite i set up a test flash file. 1. displayobject with number of childobjects. 2. Some or all childobjects are performing a tween. 3. after the tween, the multiple childobjects must be removed. My problem is when i use removechild on my childobjects, i never get to see the tween. Anyone who knows how to accomplish this? import com.greensock.TweenLite import fl.motion.easing.* import flash.display.MovieClip; var clipcontainer:MovieClip = new MovieClip() addChild(clipcontainer) for(var i:int = 0 ; i < 15 ; i++) { var myclip:clip = new clip() clipcontainer.addChild(myclip) myclip.x = 200 myclip.y = 15 + i * 32 myclip.name = “object” + i } for(var j:int = 0 ; j < 15 ; j++) { //clipcontainer.removeChild(clipcontainer.getChildByName("object"+j)) var object = clipcontainer.getChildByName("object"+j) TweenLite.to(object,1,{x:object.x + 50, alpha:2, rotation:45,delay:2}); } //how to remove my childrenobjects from clipcontainer after tweenlite??? for(var k:int = 0 ; k< 15 ;k++) { TweenLite.getTweensOf(clipcontainer.getChildByName("object"+k)) clipcontainer.removeChild(clipcontainer.getChildByName("object"+k)) } Problem solved. i have chosen for a drag and drop system. Now the player can automatically make his choice. drag and drop with eventlisteners is easy to build in flash and AS3.0 2 functions onDrag, onUP with mouseEvent 2 eventlisteners onMouseDown and onMouseUp one critical issue….debug invalid moves etc….. important that when you use drag and drop……make sure that all the bugs are worked out. hey, i’m building a tile based game pawn solitaire wich is a known board game. This time i try to build it in flash. i tought i had everything in mind for making the game. I build everything in a mouseEvent. Click on a pawn and it checks on every surrounding row and colum it can move to. Now in some situations some of the pawns can move to multiple positions and i didn’t count for that in my study to make the game leaves me with an serious bug to deal with. Other examples i found on the internet work often with an drag and drop system but i wanted to play my version a little faster. One click for every pawn… no dragging or whatsoever…… Can anyone help me for a good solution? That works although i had to work out a few bugs…. Hello, I have a strange collision detection problem… A maze of balls ( rows & colums ) and a ball i firing on it. When the speed of the fired ball is to high i get some strange display results. the ball overlaps another ball in the maze en that is not entirely correct. They should be stacking like a bubbleshoot game. Everything works as it should be when i use a low speed for the fired ball. For the collision i loop the entire maze with the fired ball en when a collision is detected i use a break statement because there is no point in continuing to look for collisions… Can anyone explain why i get odd result with higher speeds? Hello, i want to make a prototype tile based game as bricks breaker. I know how to setup some elements to setup a flash game, have experience with AS3.0 and did some reading in de book “Flash game development by example”. What have I done? 1. Make a grid of rows and colums(12*12) of colored tiles and stored their Timeline framenumber as the color in an multidimensional array. A basic setting of a tile based flashgame. (Frame 1: yellow tile, frame 2: red tile,….) In Array (1,2,…) 2. Add for each tile a mouseEvent. When I click on it , the tile must be removed from the grid and the array must be updated of its value. 3. Certain areas in the grid have the same color. That area ( same color ) is removed using a floodfill. Those 3 steps are completed and working. Now I must find a way to drop down all the tiles above the removed area. So you can say that for each colum the tiles must shift down ? x tiles. Also when an entire colum is removed, all the tiles on de left side of that colum must shift 1 tile to the right. People who already played this game know what i mean….. The only clue that I have is “backtracking algorithm”? I am not sure if this can help me ? How does it work en how do you implement it? It seems a simple logic problem, however it is not always that easy….. is there a way to share my AS files here? Can anyone help me on this one? Thank you..