Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package classes
- {
- import net.flashpunk.*;
- import net.flashpunk.graphics.*;
- import net.flashpunk.masks.*;
- import classes.*;
- public class Grounds extends Entity
- {
- private static const TILES:Class=Assets.TILES_LEVEL;
- /**
- * Floors information.
- */
- public var tiles:Tilemap;
- public var grid:Grid;
- public function Grounds(level:XML)
- {
- // set entity type
- type = "solid";
- trace(level.@width+" "+level.@height);
- // create and populate the tilemap from the level XML
- //tiles = new Tilemap(Assets.TILES_LEVEL, 1024, 1024, 16, 16);
- graphic = tiles = new Tilemap(TILES, level.@width, level.@height, 16, 16);
- for each (var tilexml:XML in level.Tiles[0].tile)
- {
- tiles.setTile(tilexml.@x/ 16 , tilexml.@y/ 16, tiles.getIndex(tilexml.@tx/ 16 , tilexml.@ty/ 16 ));
- }
- // create and populate the collision grid mask from the level XML
- mask = grid = new Grid(level.@width, level.@height, 16, 16);
- for each (var solid:XML in level.Grid_Ground[0].rect)
- {
- grid.setRect(solid.@x / 16, solid.@y / 16, solid.@w / 16, solid.@h / 16);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment