Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Anyone using Flixel-gdx?

A topic by Rombus created Apr 03, 2016 Views: 616 Replies: 11
Viewing posts 1 to 5
Submitted

Anyone using flixel-gdx for the jam?

It seems that FlxCollide() doesn't work at a display resolution < 256

Submitted

I got it working, seems that the only way to do it is to use the FlxG.camera.setScale() method. Using zoom or even upscaling the sprites wont work.

Here's detailed what I did:

  1. Set window size to 512x512 in the desktop application
  2. Set the screen resolution to 256x256 in the FlxGame core application
  3. In your FlxState set te camera scaling like so: FlxG.camera.setScale(4,4); That way you'll have a 64x64 grid in a 256x256 screen resolution.

Problem is that if you resize the window, you'll loose the 64x64 grid and achieve a full 256x256 resolution. But I guess that property can be disabled.

I've had troubles with flixel zoom, it's quite complicated... but nice tips!

Submitted (1 edit)

I'm afraid that what I wrote doesn't fix the bug entirely. I have a map 20 tiles long (tiles are 16x16) and the last 2 tiles are somehow non collidable. If I change the resolution to a bigger value the bug doesn't happen.

I'll see if today can fix it, if not I'll end up switching engine :\

(+1)
You have to update your scroll bounds! That's the reason I think, if the camera doesn't render those tiles they don't collide
Submitted

mmmm, thanks for the comment! I'll see if I can find something related to bounds.

What do you mean by "if the camera doesn't render those tiles"? I'm seeing the tiles, but maybe the camera is not aware of them?

(+1)

The camera size is for example 640x480 but if your tilemap is 1024x760 only the area cover from (0,0) to (640,480) wil be collidable. You have to set FlxG.camera.setBoundsRect(0,0,tilemap.width,tilemap.height, true), the boolean value advice to the camera to take into account the non render piece of tilemap (the area outside the current camera viewport).

Submitted(+1)

Yes! you're totally correct! thanks a lot man :D

Here's the line

FlxG.camera.setBounds(0, 0, tileMapWidth, tileMapHeight, true);

where tileMapWidth and tileMapHeight are in pixels (tilesize in pixel * number of tiles).

Yes! That's the way, sorry for not posting the code before but i wasn't at my computer, nice to know you got it right!

(+1)

Wow, i have to admit that i didn't know anything about flixel-gdx, i work with haxeflixel but its almost the same core :P

Submitted

I never tried haxeflixel, is that action script?

I really recommend flixel-gdx. Has a lot of work done for you without including any other library

(+1)

It's written in haxe, crossplatform and wirh new features. They release 4.0 a little time ago, the community ia very helpful i strongly recommend it. Take a look haxeflixel.com