Changing background color from black

1,660 views
Skip to first unread message

Zeeshan Ahmad

unread,
Jul 1, 2014, 5:21:29 AM7/1/14
to haxef...@googlegroups.com
Hi
Does someone know how to alter the background color in the game?
I have changed in Project.xml to:
<window width="480" height="800" fps="60" background="#ffffff" hardware="true" vsync="true" />

And FlxG class doesn't seem to have the property "bgColor".

I have the latest haxeflixel lib installed.
Thank you.

Zeeshan Ahmad

unread,
Jul 1, 2014, 5:30:50 AM7/1/14
to haxef...@googlegroups.com
Ok, just found the solution. In each state, the property bgColor is available.
Is there a way to change the default bgColor?

Gama11

unread,
Jul 1, 2014, 6:38:20 AM7/1/14
to
state.bgColor is just a shortcut to FlxG.cameras.bgColor. When a new camera is created, it uses the color specified in FlxG.cameras.bgColor, so in a way that's the "default".

Gamepopper

unread,
Nov 13, 2014, 7:04:11 PM11/13/14
to haxef...@googlegroups.com
Suddenly I am unable to change the background colour from FlxG.cameras.bgColor using either the static FlxColor values or the int values (e.g. 0xe5e519). Is there a new step that I'm missing?


On Tuesday, July 1, 2014 11:38:20 AM UTC+1, Gama11 wrote:
state.bgColor is just a shortcut to FlxG.cameras.bgColor. When a new camera is created, it uses the color specified in FlxG.cameras.bgColor, so in a way that's the "default".

On Tuesday, July 1, 2014 11:30:50 AM UTC+2, Zeeshan Ahmad wrote:

SruloArt

unread,
Nov 14, 2014, 4:30:03 AM11/14/14
to haxef...@googlegroups.com
You are probably changing it later somewhere so it looks like you didn't do anything. Use trace.

Thomas Bernard

unread,
Nov 20, 2014, 8:42:38 AM11/20/14
to haxef...@googlegroups.com
Just to mention that there seems to be a bug if you directly modify FlxState.bgcolor after the FlxState initialization. In that case, the FlxSpriteGroups contained in this State are not rendered on screen anymore.
Directly modifying FlxG.camera.bgcolor works though.

Gama11

unread,
Nov 20, 2014, 9:35:54 AM11/20/14
to haxef...@googlegroups.com
That sounds very strange, do you have an example that reproduces that?
Reply all
Reply to author
Forward
0 new messages