This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import net.flashpunk.*; | |
import net.flashpunk.masks.*; | |
import net.flashpunk.graphics.*; | |
import flash.geom.*; | |
public class Level extends Entity | |
{ | |
[Embed(source = 'assets/bwtiles.png')] private const TILEIMAGE:Class; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is part of level.as | |
var collisionGrid:Grid = new Grid(97,97,16,16); | |
collisionGrid.usePositions = true; | |
collisionGrid.setRect(0,0,90,90,true); | |
mask = collisionGrid; | |
//and this is in the update method of player.as | |
if(collide("level",x,y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(collide("level",x+8,y+24)) | |
{ | |
trace("collision!"); | |
y = oldy; | |
x = oldx; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collisionGrid:Grid = new Grid(96,96,16,16); | |
for(i = 0; i < 96; i++) | |
{ | |
for(j = 0; j < 97; j++) | |
{ | |
if(myTiles.getTile(i,j)==0) | |
{ | |
collisionGrid.setCell(i,j,true); | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import net.flashpunk.*; | |
import net.flashpunk.graphics.*; | |
import flash.geom.*; | |
public class Level extends Entity | |
{ | |
[Embed(source = 'assets/bwtiles.png')] private const TILEIMAGE:Class; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Master.as | |
package | |
{ | |
public class Master | |
{ | |
public static var levelData:Vector.<DungeonWorld>; | |
public static var currentLevel:uint = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import net.flashpunk.World; | |
import Master; | |
public class DungeonWorld extends World | |
{ | |
public function DungeonWorld() | |
{ |