How do I resize tiles?

40 views
Skip to first unread message

Flabby_Fabby

unread,
Apr 26, 2015, 11:55:07 PM4/26/15
to haxef...@googlegroups.com
I want to make my game have 16x16 tiles but scaled up to 64x64 so I can clearly see the pixels.

I'm having trouble getting the tiles scaled up in the game when loading a tilemap. How should I do this?

I don't want to use camera zoom because doesn't that decrease the number of pixels I can play with so the movement wouldn't be as smooth?

Karl Penzhorn

unread,
Apr 28, 2015, 8:47:33 AM4/28/15
to haxef...@googlegroups.com
Not sure what you mean by "decrease the number of pixels <you> can play with" but the way they handled this in the dungeon crawler tutorial is just to change the game width and height in Main.hx http://haxeflixel.com/documentation/part-vi-zoom-and-cameras/

Flabby_Fabby

unread,
Apr 28, 2015, 12:54:41 PM4/28/15
to haxef...@googlegroups.com
Is there any negative side effect from zooming in? Would the images try to render to the nearest pixel? so if I zoom in by 10 will the sprites try to snap to the next 10x10 pixel?

Diego Machado

unread,
Apr 29, 2015, 7:06:46 AM4/29/15
to haxef...@googlegroups.com
The "right" way to do this would be something like this:

First, you have to know the target resolution for your game when it's "scaled up". Let's say I want it to be 800x400.
So, you go to your Project.xml and put in these values on the window tag:

<window width="800" height="400" fps="60" background="#000000" hardware="true" vsync="true" />

Now, we should calculate your scale factor. Your original tileset has 16x16 tiles, and you want them to be 64x64. That's a 4 scale factor for your game. 
So, your game size should be 800/4 x 400/4 => 200x100. Now, go to Main.hx and put in these values on the following variables:

var gameWidth:Int = 200;
var gameHeight:Int = 100;

I think that should do it. ;)
Reply all
Reply to author
Forward
0 new messages