Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411525 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 06:40:21 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsEasy Peasy 2D Glow/Lighting (Uses Surfaces)
Pages: [1]
Print
Author Topic: Easy Peasy 2D Glow/Lighting (Uses Surfaces)  (Read 4559 times)
ink.inc
Guest
« on: August 31, 2011, 10:54:13 PM »

Right, this tutorial teaches you how to implement easy 2D lighting using Yoyogame's Game Maker 8 through the use of surfaces. For a reference on what surfaces are, check out ChevyRay's tutorial here:

http://forums.tigsource.com/index.php?topic=7441.0

I've made an example .gmk available here:

http://www.host-a.net/u/jtsandoval/lighting%20example.gmk

How This Works:

You have 2 objects - a control object (which I have called oCameraControl) and a light object(oLight). Upon initialization, oCameraControl draws a surface over the entire screen. For each instance of oLight in the room, the object oCameraControl will cut out holes in that surface in the given X and Y coordinate of each oLight.

Things to Remember:

1. Note that GM's surfaces may have issues on certain computers. Also note that surfaces don't work in 3D mode.
2. The checkbox for oLight that is labeled 'visible' must be unchecked (it should not be seen). The code in oCameraControl does all the drawing.
3. The sprite sLight can be animated for a more 'glowy' effect.
4. That's pretty much it.

Here's a pic of the type of effect this can achieve:
« Last Edit: September 01, 2011, 12:13:32 AM by John Sandoval » Logged
Geeze
Level 5
*****


Totally.


View Profile
« Reply #1 on: September 01, 2011, 07:28:07 AM »

Also note that surfaces don't work in 3D mode.
Surfacefix?
And actually 8.1 supports surfaces in 3D
Logged

ink.inc
Guest
« Reply #2 on: September 01, 2011, 01:25:53 PM »

Ah, I've only got version 8.0.
Logged
lordcyber12
Level 0
**


View Profile
« Reply #3 on: September 04, 2011, 04:24:33 AM »

I finally discover why the light circles habe overlap issues in my lighthing system:lack of the sprite_set_alpha_from_sprite() function!
Thanks for help me understand this function.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic