Graphic Error Help


(westGVan) #1

I’m trying to use the graphics component along with a sprite sheet, when I try to make a sprite sheet a graphic it prints out this error: " Error: Syntax error: expected a definition keyword (such as function) after attribute graphic, not playerSpriteMap"

Not sure how to fix this please help me

Heres some of the code I think needed, if you need more please ask.


[Embed(source = "../assets/graphics/playerSheet.png")] private const PLAYER:Class;
		public const SPRITE_HEIGHT:Number = 32;
		public const SPRITE_WIDTH:Number = 32;
		
		public var playerSpriteMap:Spritemap = new Spritemap(PLAYER, SPRITE_HEIGHT, SPRIGHT_WIDTH);
		
		public var mode:String = "standRight";
		public static var speed:Number = 2;
		
        public function Player() {
			setUpSpriteSheet();
			
			graphic playerSpriteMap;
			playerSpriteMap.play("curAnimation");
            setHitbox(32,32);
            x=305;
            y=225;
        }

(Zachary Lewis) #2

I think you just made a typo.

The line:

graphic playerSpriteMap;

Should be:

graphic = playerSpriteMap;

(westGVan) #3

Okay it worked, thanks a bunch!