Highlighted

How can I add a border to a grid in game?

New Here ,
Jan 27, 2019

Copy link to clipboard

Copied

I have a matching game that sets up a grid in code for the icons, and I want to add a border of some sort around the grid. How would I do so? Here is the code that sets up the grid:

public function startMatchThree() {

// create grid array

grid = new Array();

for(var gridrows:int=0;gridrows<8;gridrows++) {

grid.push(new Array());

}

setUpGrid();

isDropping = false;

isSwapping = false;

gameScore = 0;

addEventListener(Event.ENTER_FRAME,movePieces);

}

public function setUpGrid() {

// loop until valid starting grid

while (true) {

// create sprite

gameSprite = new Sprite();

// add 64 random pieces

for(var col:int=0;col<8;col++) {

for(var row:int=0;row<8;row++) {

addPiece(col,row);

}

}

TOPICS
ActionScript

Views

118

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How can I add a border to a grid in game?

New Here ,
Jan 27, 2019

Copy link to clipboard

Copied

I have a matching game that sets up a grid in code for the icons, and I want to add a border of some sort around the grid. How would I do so? Here is the code that sets up the grid:

public function startMatchThree() {

// create grid array

grid = new Array();

for(var gridrows:int=0;gridrows<8;gridrows++) {

grid.push(new Array());

}

setUpGrid();

isDropping = false;

isSwapping = false;

gameScore = 0;

addEventListener(Event.ENTER_FRAME,movePieces);

}

public function setUpGrid() {

// loop until valid starting grid

while (true) {

// create sprite

gameSprite = new Sprite();

// add 64 random pieces

for(var col:int=0;col<8;col++) {

for(var row:int=0;row<8;row++) {

addPiece(col,row);

}

}

TOPICS
ActionScript

Views

119

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 27, 2019 0
LEGEND ,
Jan 28, 2019

Copy link to clipboard

Copied

You can use the Rectangle class to draw a rectangle.  Check out the documentation and examples via the following link...

Rectangle - Adobe ActionScript® 3 (AS3 ) API Reference

Also, try looking thru Google searching AS3 Draw Border.  There are a few different approaches you might take, from drawing lines to adding a glow filter.

https://www.google.com/search?client=firefox-b-1&q=AS3+draw+border

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 28, 2019 0