Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075927 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:55:22 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Multiple rooms/screens with flixel
Pages: [1]
Print
Author Topic: Multiple rooms/screens with flixel  (Read 1068 times)
The Hug
Level 0
**



View Profile Email
« on: January 13, 2011, 01:04:03 PM »

I'm working on a game (duh.) Devlog here: http://forums.tigsource.com/index.php?topic=16548.0

I am using Flixel. I think this will be my first finished, released game. The in-game world will likely be small, but hopefully interesting and fun to explore.

A big part of the game is the lighting. Right now I have a grid of black square FlxSprites whose alpha value is adjusted each update based on the location and intensity of light sources on screen.

While I would like to have the small world be one, seamless "screen", the game is already starting to see severe frame rate slowdown with only a few light sources.

I guess I have two questions:
First, is there a less memory-intensive way to get a similar-looking dynamic lighting effect? I imagine I am not doing this right.

Second, if I have to break up the level into multiple screens/rooms, is there a good way to do this with Flixel, keeping track of variables/objects in rooms, loading tilemaps etc.

Room/Game State handling is actually something I generally need to get under my belt as a game programmer, so any help/links as to how this ind of thing is normally done, or at least a sort of satndard model, if it exists, would be awesome. I'd rather not rely on programs like Game Maker in the future, so I can be a "real" programmer! Yay!
Logged
Fallsburg
Level 10
*****


Fear the CircleCat


View Profile
« Reply #1 on: January 13, 2011, 01:42:47 PM »

Yes, yes there is.

If you don't care about the blockiness, you can have a black sprite that is always on the screen and then draw in transparent areas where the light is.

If you do care about the blockiness you can just have a tilemap.  I can't find the exact link right now, but on the flixel forums someone posted a slightly modified FlxTilemap class that allows for multiple values (not just on/off) and a spritesheet where the rows are the different values and columns are the different configurations.

Failing that, you can just have as many sprites as you need to fill the screen (looks like 11 x 15, but my counting might be off) and then just have the relevant lightsources affect the corresponding sprites.  Just set the scrollfactor to 0.
Logged
InfiniteStateMachine
Level 10
*****



View Profile WWW Email
« Reply #2 on: January 13, 2011, 04:09:24 PM »

Flixel has photoshop-like blend modes. I'm not sure if this is what you want but I would make a layer on top of the gameworld that was just a black screen with a alpha somewhere in the middle range. After that I made a light sprite and set it's blend mode to Screen (IIRC) which sort of burned lighting through the black haze.

You can see it in action here:

http://www.kongregate.com/games/AlexStateMachine/abomination-descent-ludum-dare-18
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic