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


Similar Posts:


ActionScript 3.0 :: URLRequest - Check Image Existance?

Jan 12, 2011

how to check whether the URL given to URLRequest really exist or not? for e.g.,

var a:Loader = new Loader();
var b:URLRequest = new URLRequest("C:/123.jpg");

now here, how can I check whether the URL given to variable " b " is really there or not?

var a:Loader = new Loader();
var b:URLRequest = new URLRequest("C:/123.jpg");
a.contentLoaderInfo.addEventListener(IOErrorEvent. IO_ERROR, error);

View 1 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 :: Check The Existance Of Another Tile To The Left, Right, Or Above And Below, Otherwise The Tile Should Not Be Placed?

Apr 19, 2011

I'm making a game where you place tiles on a grid. When placing a tile, I need to check the existance of another tile to the left, right, or above and below, otherwise the tile should not be placed.. Here is a function I thought would work, that accepts one variable (the position of the tile just as it is about to be placed) :-
 
private function checkSurroundingTiles(gridPosition:uint) {                 var t1 = gridPosition - 12;     var t2 = gridPosition - 1;     var t3 = gridPosition + 1;     var t4 = gridPosition + 12;                 for(i = 0; i < gridRefArray.length; i++) {          var checkTile = gridRefArray[i];                          if(checkTile == t1) {               return true;

[code]....

View 11 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

Actionscript 3 :: Check If Flex Datagrid Column Contains Data?

Dec 5, 2011

Is there a way to check if flex datagrid column is empty or not? I tried to search for a DataGridColumn that would allow me to that but I couldn't find any.

View 1 Replies

ActionScript 3.0 :: Checking For Existance Of A Symbol (null Object Reference Error)?

Jan 13, 2010

In Actionscript 3, I'm trying to build a button to go back from a content frame to a main menu. When the button is clicked, IF the content frame has a movie in it, that movie should stop playing. Flash keeps throwing a "null object reference" error on all pages that don't include a movie. I even tried putting in a check to see if the movie exists, but that doesn't work, either.

ActionScript Code:
function return_to_menu( me:MouseEvent ):void {
if ( flashmo_contents.flv_movie ) { //this line produces errors in frames where the movie

[code]....

View 2 Replies

Flex :: Flash - DataGrid Column Width: One Column To Rule Them All?

Nov 16, 2010

I have a Flex 4, mx:DataGrid with the following (pertinent) properties set:

width="100%"horizontalScrollPolicy="off"

I have the minWidth set on all of the DataGridColumns and the width set on one of them. If I simply maximize/minimize the display (in browser or stand-alone flash player) of the application, the columns scale up and down nicely. But if you grab the edge of the application and drag it to make it bigger, only one column grows really big. When you drag the size down again, the one column remains big, but all of the other columns get squished way down.

View 3 Replies

Flex :: Get Column Index Of Header Column In AdvancedDataGrid?

Mar 9, 2010

I want to know column index of header in AdvancedDataGrid when a user clicks on header - either left click or right click.

View 1 Replies

Flex :: Drag And Drop Column Data To Another Column?

Jan 29, 2011

In Flex, using AdvancedDataGrid, I'm trying to achieve a drag and drop of one row's column data to another row's column or the same row but different column. Is this even possible? I've been googling for hours and all I can find are drag and drop whole columns just to rearrange their view order.

View 1 Replies

IDE :: Make A Table In Flash And Enable The Column Headers On The Table To Sort Column On Click?

May 4, 2009

How to make a table in Flash and enable the column headers on the table to sort column on click?I have seen some tutorials with mySQL but I'd like to start with something basic. Is a sortable table possible using just Flash and AS 2.0?

View 1 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 :: 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 :: 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

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







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