ActionScript 3.0 :: Swapping Tiles From Board (9 Frames)

Dec 29, 2009

I create a board using the class Baldosa (which is a tile on my .fla file with 9frames, each is a tile of a different color). I first create and array of numbers which indicates which frame (color) the baldosa element will display. As grey baldosas are more than the other colors (this is intended), then I unsort the array to avoid grey baldosas accumulating on the right side of the board. Then I push each baldosa in an array, and add each of them as child of the contenedorBaldosas(container) to avoid adding events for each Baldosa.

The problem comes when I want to check collisions. If there's a collision, I swap positions of each Baldosa. It only works if I swap the tile at depth number 0 and the last at depth 79, for the rest of Baldosas, it doesn't detect any collision (the baldosa clicked will return to its original position as nothing had happened. I made a trace and it seems the baldosa clicked doesnt collide with another baldosa in the array (each baldosa is given the name baldosaxx using the variable in the for loop), but rather an unnamed instancexxxx.

Also I'm treating the baldosa elements as Sprites, but as the baldosa in my .fla is a MovieClip, and it contains a Timeline where each frame is a baldosa of a different color, the problem may be also here.
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
[Code] .....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: A Board Game - Get Classes To Putting Together A Board Game?

Mar 22, 2010

where to get classes to putting together a board game, free of course.I do not want to use them actually but get the idea of how mine would incorporate into the classes.I have a board game where I want each square on the board to know if it is occupied or not, to change its color, and to keep track of what is actually happening with it.

View 2 Replies

ActionScript 3.0 :: How To Make Tiles

Dec 7, 2009

How do you make tiles in AS3? I can't find any good tutorials that actually teach it. I'm wanting to create an isometric tile based game, but I don't understand how to make the objects line up together.
 
I have an isometric engine in AS2 but I don't know how to get it into AS3.

View 5 Replies

Flash :: Represent Tiles In XML?

Jun 28, 2010

So, I'm writing an AS3 program that tiles floor tiles. I want the user to be to be able to create their own floor schematic represented by different rectangles. It'll be drag-and-drop. They will lay out their schematic (which is composed of different size rectangular tiles) and drop colors/patterns onto them.

This schematic will then be tiled on a 3D plane to represent what the actual floor would look like.

I've got the 3D part working, drag-and-drop working, etc. What I'm missing is the floor schematic stuff. I've spent a lot of time trying to figure out the best solution, but I can't QUITE get there.

Here are some examples (out of a WHOLE bunch of possible combinations) of how the floor schematics could look:

The different tiles within the schematic are the droppable regions. My problem: How can represent these schematics in XML? Don't worry about tiling, sizing, etc. I've got that all figured out already. I just literally do not know how I can represent a tile schematic in XML and draw it correctly with AS3.

View 4 Replies

IDE :: Pathfinding With Direction Tiles

Oct 25, 2009

I've been experimenting with path finding, in particular the A* algorithm. I've understand the basics for it and can currently get an object to move from point A to B avoiding walls. However I'm trying to create one way blocks, (then eventually add turn left and right only and T juncs etc) so I don't have to use thick walls to prevent the object from taking a certain route. The code I have so far is....

[Code]...

View 1 Replies

ActionScript 3.0 :: How To Place Tiles On Background

Sep 17, 2010

I'm trying to place tiles on background. I have a tile (20X20) on stage ( 600X400px) and I have declared it as a Symbol of Class BgTile (also have checked to export for actionscript), Problem is that it is working only partially. Some Tiles in the second row are missing and a (or more) tile(s) is(are) placed at the origin (Registration point is in the center) strangely.

function CreateBG():void{
for(var i:uint=0;i<20;i++){
for(var j:uint=0;j<30;j++){
var tempBG=new BgTile();
tempBG.name="tile"+i+j;
addChild(tempBG);
getChildByName("tile"+i+j).x=j*20+10;
getChildByName("tile"+i+j).y=i*20+10;
}}}
CreateBG();

View 4 Replies

ActionScript 3.0 :: Making A Column Of Tiles?

Oct 12, 2010

I'm trying to learn how to make grids using the Vector method. I have my tiles set at 100x100. I made a function to layout the first set of tiles in the first column. Here is my function:

public function Grid():void  { for ( var i:int = 0; i < 5; i++)  groundTileList.push(new Ground_tile());  var column:Ground_tile = groundTileList[i];  addChild(column);  column.x += 100;  }

[code]....

View 3 Replies

ActionScript 3.0 :: Get Multiple Tiles From One Picture?

May 24, 2011

I have a .png file with 16x16 tiles that I want to make into their own variables. I've tried using BitmapData like this:

bitmapData=new BitmapData(16,16,true,0x000000);
bitmapData.draw(loader);
bitmap=new Bitmap(bitmapData);

addChild(bitmap);But I then realised that would only work for the top-left tile of the picture. How would I be able to get the rest of the tiles?

View 2 Replies

ActionScript 2.0 :: Create A Map Using Tiles And An Array?

Nov 9, 2009

This is my first time using Actionscript in probably 4 years and I'm learning everything all over again. For example, here's what I tried to jump right into doing and just realized I don't remember how. I'm trying to generate a world map out of tiles I created in Photoshop. I've created a symbol in the library for each tile and want to use an array and a for loop to create the full map.

So far I seem stuck on creating the array itself. I've started by creating a variable for each tile that exists such as m73 = "Lake South" where "Lake South" is the name of the symbol in the library. The full map will be a 32x32 grid of tiles but for now (until I get it working) the array is much smaller. An example of it is like this:

worldMapArray = [m4,m4,m4,m4]
[m0,m4,m4,m4,]
[m17,m16,m16,m16];

Hopefully this is enough to convey what I'm trying to do. However, when I use something like trace(worldMapArray[0][1]); it comes up as undefined. I've already created the needed for loops that use attachMovie for each iteration in the array, but as the array itself isn't set up right nothing happens.

View 1 Replies

ActionScript 2.0 :: Grid With Different Size Tiles?

Mar 12, 2011

following a recent question below is the code for a grid with different size tiles

Code:
var mcWidth:Number = 50;
var mcHeight:Number = 50;
var spacing:Number = 5;
var numberOfRows:Number = 3;

[code]....

View 0 Replies

ActionScript 3.0 :: Resizing Tiles Using Loops?

Mar 18, 2011

I found the following code online for a Flash Memory Game. You click on pairs on grey tiles, when you click they reveal a color and when the two colours match the tiles disappear.

The problem I'm having is that the tiles are too big and I need to resize them. However when I do only the first 9 of 16 tiles are resized. It's as if the nested loops calculate the first 9 tiles and the last row and column take up whatever space is left.

Anyway lines 19 and 20 are the ones in which the tiles are calulated:

tile.x = (x-1)*50;
tile.y = (y-1)*50;

Code:

package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.TimerEvent;

[Code]....

View 4 Replies

ActionScript 3.0 :: Generating The Random Tiles?

May 5, 2011

I have an engine for platformer game and I need to generate random blocks while moving and of course delete old ones, when the hero leave pervious position.Here is the code for generating random platforms when the game starts (costructor):

ActionScript Code:
public function TheGame()
{
bla-bla...

[code]....

As you can see, I create a loop which creates 10 platforms in different positions.My goal is to create a function which will delete blocks from the array which are not in the stage anymore and create new blocks when screen is moving up.

View 2 Replies

ActionScript 3.0 :: Managing Many Tiles (or Symbols)

Mar 5, 2012

I'd like to display a group of squares following a pre-determined path to create rows. Like row 1 to 10 would be Row1(), 11 to 20 Row2() and so on. The main reason for this is to hide the Menu before actually showing/building it. After the Menu is build up, I could remove the squares any way I want to reveal the Menu behind.

View 0 Replies

ActionScript 2.0 :: Creating Field Of Tiles?

Jan 7, 2007

Basicly this should work just like a non OOP tile game board. It just stacks the tiles on top of each other and never changes the color. So I assume that _root.cname is the wrong way to referance it.

Code:
//Create beginning variables
var checks_ver:Number = 8;

[code].....

View 3 Replies

ActionScript 3.0 :: Check The Existance Of Other Tiles On The Same Row And Column?

Apr 20, 2011

I'm working on a tile game and need to figure out an equation.. I have a grid which is 12x11.. when I place a tile I need to check the existance of other tiles on the same row and column and add up their values..I need to create an equation with the following variables :-
 
Receives a number between 1 and 132 :-
 
divides and/or multiplies the number into all the possible divisions of 12 in between 1 and 132 adds or subtracts the correct amount of tiles which lie either side dependant on it's position(I have drawn out the grid, and, for example, tile 66 has five tiles either side, tile 121 has 11 to it's right because it's in the bottom left hand corner)

View 10 Replies

Actionscript 3 :: Image - Slice A Bitmap Into Tiles

Aug 9, 2011

I have the Bitmap data from a Loader object and I would like to slice it up into 32x32 squares to use as tiles. What is the most efficient way to do so?

View 2 Replies

ActionScript 3.0 :: Snap MovieClips Together - Hybrid Tiles

Apr 11, 2011

Here's the functionality I am trying to achieve: I have 30 tiles on my stage. I can move them around through multitouch like this:

ActionScript Code:
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.events.TouchEvent;
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
for(var i:int = 1;i<=30;i++){
this["tile"+i].addEventListener(TouchEvent.TOUCH_OVER, onBegin);
}function onBegin(e:TouchEvent):void{
e.currentTarget.startTouchDrag(e.touchPointID)
}

What I want to happen is that when a tile is released on another it snaps to that tile and they become one tile so when moving around you actually move them both. When you release the 2 tile 'hybrid' onto another tile it becomes three tiles together and so on.

View 0 Replies

ActionScript 3.0 :: Random Grid With Different Sized Tiles?

Jul 23, 2009

need to fill a grid with tiles that will be of different sizes,but all multiples of the stage size - something like this:I want to randomize number of tiles placed into the grid without having any tile overlap. It will then place a tile at a random position on the grid, but not in any grid cells that have already been covered by a tile. And...also I want the grid/tiles to be dynamic enough to scale if the stage is resized.

View 14 Replies

IDE :: OOP/Event Related: Transition Game Tiles?

Oct 13, 2009

I'm working on OOP skills by creating a fun Mahjong game. I made a working concept (not very OOPed yet), and am trying to get everything OOPed before its too late. I want the tiles to transition in, maybe teleport in like a Star Trek movie. The tile object is a movie clip, so it can play the transition as it is added to the stage. Tiles will be added in, in increments so there's a cool wave-like effect of teleporting.

How would I know when the tiles have finished transitioning in? Would the tiles generate an events that the game object detects, starting the game after receiving X 'finished' events? Or should I create a timer in the game object where the amount of time to wait for the transition depends on the number of tiles being added to the board?

I think I'm close, but could use any general feedback on the concept. The coding is not an issue. I'm just trying to wrap my head around things.

View 2 Replies

ActionScript 2.0 :: Create Tiles Based On A 2 Dimensional Array?

May 28, 2008

I'm having a big problem with my tile-based game. I create tiles based on a 2 dimensional array. Each tile is a Movie Clip, created using attachMovie. The problem is that when there are many of these tiles, the game lags, because so many properties must be stored for each MC. Is there a better method for creating "tiles" than attachMovie, or a way to free the memory used for each one?

View 10 Replies

ActionScript 3.0 :: Turning Image Into Tiles And Random Movement?

May 7, 2011

Im looking to convert an image into set number of tiles, and have the tiles just randomly move around for a few seconds before falling back into place to create the image. Id have this looped indefinately aswell.

View 6 Replies

ActionScript 3.0 :: Nested For Loop - Update The Tiles With The New Array Value?

May 25, 2011

i'm running a simple nested for loop (code below) that when you go over a tile makes it change its color, so far so good but i also want to make it so that when you go over a tile you can then continue only on the tiles connected to it

Code:
for (var colum = 0; colum < field_h; colum++)
{
for (var row = 0; row < field_w; row++)[code].....

i think i should be able to do it using arrays but i can't seem to understand how after the tiles are placed and the array updated accordingly to update the tiles with the new array value (enter frame event ? )

View 5 Replies

ActionScript 2.0 :: Setting Up The Tiles On The Screen - AttachMovie Not Working

Jun 22, 2011

I'm trying to build a little tile editor for a game I'm about to make, but in setting up the tiles on the screen something goes wrong. Here's the code:

[Code]...

the trace just spits a whole bunch of 'undefined's at me. I double checked the variables once again just to be sure, and they're all right.

View 1 Replies

ActionScript 3.0 :: Drawing Small Tiles Into One Large Bitmap Container

Jan 29, 2010

I have a project that is drawing ~10,000 small tiles into one large bitmap container - it's a mosaic. In Flash proper and in FireFox it takes about 20 seconds to complete the drawing. Very acceptable. In Chrome it takes about 1:30 and in IE it takes roughly 3:00 - both too slow to be acceptable to the client - who of course reviewed with IE. I have Flash set to run at 45 fps - and the images are populated by a Timer - at 2 ms intervals. Maybe 2 ms is too fast? But in my testing 1ms was slower as was 3ms, so I kept it at 2. And it works fine in FF and Flash...

View 4 Replies

Display A SVG Layer (polygons) Over The Openlayers Tiles In A HTML Page?

Apr 21, 2010

I would like to display a SVG layer (polygons) over the openlayers tiles in a HTML page, or alternatively, load my SVG in flash and have the OL tiles rendered into flash as well.

View 2 Replies

Actionscript 3 :: Display Custom Tile For Missing Tiles In Google Maps App

Mar 16, 2010

I am working with google maps in flash, and i would like to know how to serve up my own image tile for the "we have no imagery at this zoom level..." error. I dont want to serve up an entire map of images - just for the times when google has no image does the tile layer base dispatch an event? (i couldnt find any in the api) is there a method that can be overridden by extending the tilelayerbase class

View 1 Replies

ActionScript :: Flash And Timeline - Place Tiles On Table (hitTestPoint Not Returning)

Aug 17, 2010

I am currently working on a project that involves dropping objects (scrabble letters) onto different cells in a table. My project also involved multiple levels. My layout is rather basic. I have a a bunch of tiles (25 letters) above a 2-columns table (left side for definition, right for answers). The table is static from frame 1 til the end (no keyframe, blankframe, etc.). The problem is as follows: The exercise starts fine with the first Level, then I click a button to access the next level, and so on... Going FORWARD on the timeline seems to be working OK, I am able to complete each levels in succession. However, if I decide to go backwards (replay a previous level) I can no longer place tiles on my table (hitTestPoint not returning what it should). I checked and my "target" is indeed there but somehow the hit test does not register.

[Code]...

View 1 Replies

Actionscript 3 :: Flex: Can List Be Used To Display Control In Equally Sized Tiles

Sep 2, 2010

In one of the application I am working, List has been used. I am required to display items in the form of tiles. I do not want to change the component as of now. Is there any way to achieve this layout in list only.

View 3 Replies

Actionscript 3 :: Flex 3 TileList Drag/Drop/Re-order Exception. How Do I Rearrange Tiles?

Jun 8, 2009

I'm in need of some dire help here. I'm writing an application in Flex 3 that utilizes a TileList with a custom itemRenderer to display info from a service. Unfortunately, I'm running into an exception with the drag/drop/rearrange portion of the TileList. With dragEnabled and dragMoveEnabled, I receive a fully-reproducible exception when trying to rearrange the tiles in the control:

Exception:
ArgumentError: Error #2004: One of the parameters is invalid.
at flash.utils::ByteArray/writeObject()
at flash.desktop::Clipboard/putSerialization()[code]....

When I try to debug, the debugger doesn't seem to indicate to me any piece of code that might be faulty.

View 1 Replies

ActionScript 3.0 :: EventListener:Mouse_Down Malfunction - Add Event Listeners To Check Whether Tiles Are Being Pressed?

Feb 22, 2009

Trying to add event listeners to check whether my tiles are being pressed! This works excellent! They respond to the listeners BUT on the mose_down/mouse_up i can�t trace the tile variables The listener functions:

[Code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved