Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero size objects work in game, but not during debug #35

Open
DaVince opened this issue Oct 6, 2015 · 4 comments
Open

Zero size objects work in game, but not during debug #35

DaVince opened this issue Oct 6, 2015 · 4 comments

Comments

@DaVince
Copy link

DaVince commented Oct 6, 2015

When I run a game without debug mode, the game will run and properly recognize objects (as signified by the fact that I use a "startpoint" object that is 0 wide, 0 high, and positioned in a specific place).

But when I try to run this same game in debug mode, the game crashes and outputs this in the console:

Illegal rect, sizes cannot be 0.

Same bug for circle object, though then the error there is "radius".

@ibilon
Copy link
Contributor

ibilon commented Oct 6, 2015

That's coming from haxepunk's image class.
But that's strange, this check isn't debug only, it should throw even in release.

@scriptorum
Copy link
Member

That's from TmxObject.hx, it creates a rect in debug mode only:

#if debug
            debug_graphic = com.haxepunk.graphics.Image.createRect(width, height, 0xff0000, .6);
            debug_graphic.x = x;
            debug_graphic.y = y;
#end

@DaVince
Copy link
Author

DaVince commented Oct 6, 2015

So what happens now? Should TmxObject.hx be fixed to create a 1x1 rect/circle in cases like these? Or should I always make my objects at least 1x1 big in Tiled? (That'd be a chore, frankly.)

@scriptorum
Copy link
Member

If 0x0 is a legal size, that doesn't sound like an awful solution (modify TmxObject to draw a 1x1). However, also note that the TMX file is just XML: you could throw it into a text editor and replace all height/width="0" to ="1" pretty quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants