Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jan 27, 2019 Jan 27, 2019

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
238
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 28, 2019 Jan 28, 2019
LATEST

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

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