Author Topic: DAME problem  (Read 1040 times)

xhunterko

  • Contributor
  • ****
  • Posts: 449
  • Karma: +0/-0
    • View Profile
DAME problem
« on: Tue, May 3, 2011 »
So, I was following the tutorial here:

http://www.brighthub.com/hubfolio/matthew-casperson/articles/105366.aspx

When I got to the part where it says to add this in code:
Code: [Select]
if (sprite is Player)

{

player = sprite as Player;

}



Now, my sprite that I'm using extends FlxSprite and is similar in code to the example sprite. So, why is Flashdevelop giving me these errors:

Error: Implicit coercion of a value of type Tiny(the player in this instance) to an unrelated type Class.
Error: Illegal assignment to class Tiny.

It's built the same way, what gives?
Now on twitter: http://twitter.com/xhunterko I made a game that's in alpha you can buy here: http://xhunterko.itch.io/wave-miner-alpha

Rybar

  • Contributor
  • ****
  • Posts: 279
  • Karma: +0/-0
    • View Profile
Re: DAME problem
« Reply #1 on: Tue, May 3, 2011 »
if Tiny is the name of your player class, it should be

Code: [Select]
if(sprite is Tiny)
{
player = sprite as Tiny;
}

I'm assuming you don't have a Player.as class, and your player class is named Tiny.as.

xhunterko

  • Contributor
  • ****
  • Posts: 449
  • Karma: +0/-0
    • View Profile
Re: DAME problem
« Reply #2 on: Tue, May 3, 2011 »
Well, okay, that works. Though that still presents the same problem I had with Mappy. See this:



Never minding the spikes, but take a look at where the player is located. They aren't snug to the tile map, as it were. And I just thought of something while typing this. Sure enough, the bounding box tweaks were set too large. Me being an idiot again.

Also, I don't know if this is a bug in DAME or not. But when the player does collide with the tilemap, another player is created right below them. I don't know what to do about that. Or where to report it.

Thanks again!

Now on twitter: http://twitter.com/xhunterko I made a game that's in alpha you can buy here: http://xhunterko.itch.io/wave-miner-alpha