Game Size vs Window Size vs Camera Size

82 views
Skip to first unread message

Jason Anderson

unread,
Nov 22, 2015, 9:57:25 PM11/22/15
to haxef...@googlegroups.com


Hi,

I'm working on a game where I'd like to set the game window size to 640x480 (this is set in Project.xml), a game world size of 1920x480 (this is set in Main.hx as gameWidth = 1920, gameHeight = 480), and a camera size of 640x480 which can pan to the left and right across the 1920 width of the game world.

The problem is, whenever I set gameWidth to any value larger than 640, the game window is extended to the defined width and blank padding is added to the top and bottom of the screen.

I have been able to get the visuals working properly by setting the game size to 640x480, creating sprites and such beyond 640 pixels.  This is fine, but then FlxG.overlap no longer works with any sprites beyond 640 pixels as they are outside of the game world.

Perhaps I'm missing something fundamental?

Thanks a bunch,
Jason


gameWidth x gameHeight = 640x480, zoom = 1            gameWidth x gameHeight = 1920x480, zoom = 1                                                          
640x480.PNG
1920x480.PNG

Austin East

unread,
Nov 22, 2015, 11:54:43 PM11/22/15
to HaxeFlixel
I would mess with the zoom levels. Try setting it to -1, 2, 3 or something.

byFd

unread,
Nov 23, 2015, 7:33:16 AM11/23/15
to HaxeFlixel
try FlxG.worldbounds.set(0, 0, 1920, 480); in your Playstate, collisions should work then :)

Jason Anderson

unread,
Nov 23, 2015, 6:38:19 PM11/23/15
to HaxeFlixel
I've set the gameWidth to 640 and gameHeight to 480 with a zoom of 1 in Main and set the world bounds in the PlayState as you suggested.

Works perfectly!

Much appreciated,
Jason
Reply all
Reply to author
Forward
0 new messages