Jump to content


Photo

Simple 2D lantern effect for stealth-based game


  • Please log in to reply
6 replies to this topic

#1 sournote103

sournote103

    GMC Member

  • GMC Member
  • 98 posts

Posted 26 May 2012 - 02:02 AM

I'm trying to make a stealth-based game, so obviously lighting is a major component. Unfortunately, I'm having trouble making it work how I want. Basically, what I need is an object that makes a circle of "light" that makes every pixel within it appear lighter. It would be fantastic if this effect could get weaker as is radiated out from the center. Most importantly, there need to be a few of these per room, so it can't be too laggy. I don't need anything fancy; it can pass through walls and such. Could someone give me a bit of guidance as to how to achieve the desired effect? Thanks.
  • 0

#2 Jake Armstrong

Jake Armstrong

    GMC Member

  • GMC Member
  • 390 posts

Posted 26 May 2012 - 02:08 AM

I think you would use surfaces to do something like this.

People have made engines that do lighting, see http://gmc.yoyogames...pic=405212&st=0
  • 0

#3 Russ Money

Russ Money

    GMC Member

  • New Member
  • 16 posts
  • Version:Unknown

Posted 26 May 2012 - 03:26 AM

I think you would use surfaces to do something like this.

People have made engines that do lighting, see http://gmc.yoyogames...pic=405212&st=0


Not relevant to the topic, sorry. Just wanted to say thanks for posting that, I would have never known of this.
  • 0

#4 KranKran

KranKran

    GMC Member

  • GMC Member
  • 107 posts

Posted 26 May 2012 - 08:03 AM

I'm trying to make a stealth-based game, so obviously lighting is a major component. Unfortunately, I'm having trouble making it work how I want. Basically, what I need is an object that makes a circle of "light" that makes every pixel within it appear lighter. It would be fantastic if this effect could get weaker as is radiated out from the center. Most importantly, there need to be a few of these per room, so it can't be too laggy. I don't need anything fancy; it can pass through walls and such. Could someone give me a bit of guidance as to how to achieve the desired effect? Thanks.


If you make a white circle as a sprite with the desired dimensions and the origin at its centre, then make sure your lantern has its centre as its origin, you can get the lantern to draw it with alpha=0.5 (half as opaque as normal objects.)

Good luck with your game :thumbsup: .
  • 0

#5 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2087 posts
  • Version:Mac

Posted 26 May 2012 - 01:39 PM


I'm trying to make a stealth-based game, so obviously lighting is a major component. Unfortunately, I'm having trouble making it work how I want. Basically, what I need is an object that makes a circle of "light" that makes every pixel within it appear lighter. It would be fantastic if this effect could get weaker as is radiated out from the center. Most importantly, there need to be a few of these per room, so it can't be too laggy. I don't need anything fancy; it can pass through walls and such. Could someone give me a bit of guidance as to how to achieve the desired effect? Thanks.


If you make a white circle as a sprite with the desired dimensions and the origin at its centre, then make sure your lantern has its centre as its origin, you can get the lantern to draw it with alpha=0.5 (half as opaque as normal objects.)

Good luck with your game :thumbsup: .

Yeah, this is the simplest solution. Except you're better off using the drawing functions to draw a filled white circle rather than a sprite that looks like a white circle. A sprite would increase the file size and if the sprite is not the correct size then it would need to be scaled (usually made larger)... resulting in blocky / pixelated edges rather than a curved line.
Never used alpha drawing functions before... they might not be available in Lite (if that's what's being used).

Anyway, that will get you everything "lighter"... but it will be sort of washed out / milky / dull. Reds will look pink, blacks will look gray, etc. Ad everything will look as if it is covered by a white veil or like, you're looking through a dirty window. Still, it's the simplest solution but it may not look the best.

Edited by dannyjenn, 26 May 2012 - 01:41 PM.

  • 0

#6 Madales

Madales

    GMC Member

  • GMC Member
  • 62 posts
  • Version:GM8

Posted 26 May 2012 - 01:47 PM

Look here! :thumbsup:

Edited by Madales, 26 May 2012 - 01:48 PM.

  • 0

#7 sournote103

sournote103

    GMC Member

  • GMC Member
  • 98 posts

Posted 26 May 2012 - 02:08 PM

I have something working now. Thank you everyone!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users