Jump to content


Photo

Easy Lighting V7.0.2 | Last Updated: 06/07/11


  • Please log in to reply
465 replies to this topic

#21 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2758 posts
  • Version:GM:Studio

Posted 01 December 2008 - 07:59 AM

Ok guys, I updated it, you now have your customisable suround lighting! Tell me what you think!

@bocochoco, Heh well, I will see if I can get shading in later versions, but no guarantees. :)

@Krisando, Oh I see. At the end of that room you can place light_end(); then just start it up again at the beginning of the next room. That should re-set EVERYTHING. (Though I actually haven't tested the light_end() much so there might be a few bugs, tell me if you come across any.) As for the error, I am not getting it, but I will check into it to see what is going wrong. (Also, could you download the new version and tell me if you get the error?)

EDIT: Also @Krisando, I just remembered, if you use light_set_light before using light_add_light then it should give you that error. Make sure that you are creating the light first.

Edited by Scyler_27, 01 December 2008 - 08:06 AM.

  • 0

#22 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:05 AM

Ive made the code that makes light around your mouse instead shed light around multiple objects, ill try make an example of error.
Odd that it worked in previous versions

Error Example
=]

Edited by Krisando, 01 December 2008 - 08:09 AM.

  • 0

#23 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2758 posts
  • Version:GM:Studio

Posted 01 December 2008 - 08:10 AM

Huh... Ok that would be great. What the error is saying, is that it is trying to check for the original image shape of a certain light, but that that light hasn't been created. So it is is giving an error. But this should only happen with custom lights, since you said you were using the exact code from the mouse (and that wasn't a custom light) that would be a big problem... Unless you ARE using a custom light?

EDIT: Huh, you are right... that is odd. Well, I DID upload a version with an error, but uploaded a fixed version about 1 minute later. You might just have happened to get the bad version. Download the newest version, it is v3.0 and has more features anyway. The example I uploaded with it works fine for me.

Edited by Scyler_27, 01 December 2008 - 08:14 AM.

  • 0

#24 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:22 AM

Keep with the constant updates =]

I noticed the 2 latest versions the x and possibly y coordinates have been noticibly changed position,
still get error. Ill just make it a custom light

Edited by Krisando, 01 December 2008 - 08:23 AM.

  • 0

#25 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 08:24 AM

Excellent stuff scyler. Keep the updates coming

Edited by bocochoco, 01 December 2008 - 08:26 AM.

  • 0

#26 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:26 AM

I've gotten that error too, after changing from 2.2 to 2.3. I checked treat uninitialized variables as zero and it went away. Though a fix for it would be preferable.

Thats for a workaround =]
  • 0

#27 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 08:30 AM

Hey just noticed you uploaded 3.0... I like. But I get an error, goes away with the workaround

[codebox]
In extension function light_set_light:
Error in code at line 1:
var ID;ID=argument0;global.__lightx[ID]=argument1;glob
al.__lighty[ID]=argument2;global.__lightdiam[ID]=a
r
gument3;global.__lighttype[ID]=argument4;var LIGHT;LIGHT=argument5;global.__lightangle[ID]=argu
ment6;if (LIGHT>=0&&LIGHT!=global.__lightshape_orig[ID])
{ sprite_delete(global.__lightshape[ID]) global.__lightshape[ID]=LIGHT; global.__lightshape_orig[ID]=sprite_duplicate(argu
ment5); sprite_set_alpha_from_sprite(global.__lightshape_o
rig[ID],global.__lightshape_orig[ID]); var TEMP; TEMP=global.__lightshape_orig[ID];
global.__lightshape_orig[ID]=global.__lightshape[I
D]; global.__lightshape[ID]=TEMP;}

at position 235: Unknown variable __lightshape_orig or array index out of bounds
[/codebox]

edit: fixed it so it didn't make the page expand. i hate that

Edited by bocochoco, 01 December 2008 - 09:14 AM.

  • 0

#28 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2758 posts
  • Version:GM:Studio

Posted 01 December 2008 - 08:34 AM

Hm, so it is still giving the error... Thanks... So wierd, it isn't giving it to me at all. I don't want you to have to use a work-around for it to work right. :) I will devote 10 minutes to trying to find a fix, then I need to go to bed. (2am and school tomorow. >.< ) If I don't fix tonight, I will try tomorow.

EDIT: I don't know why the example wouldn't work, but I THINK I might have found the problem. I will upload a (hopefully) fix in a few min. If it isn't the fix you have to wait till tomorow.

Edited by Scyler_27, 01 December 2008 - 08:40 AM.

  • 0

#29 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 08:37 AM

I know the feeling bro, I've got class in about 5 hours (its actually 4am here) and I've yet to sleep =) No need to update tonight, though I wouldn't complain.

Edited by bocochoco, 01 December 2008 - 08:40 AM.

  • 0

#30 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:37 AM

Hm, so it is still giving the error... Thanks... So wierd, it isn't giving it to me at all. I don't want you to have to use a work-around for it to work right. :) I will devote 10 minutes to trying to find a fix, then I need to go to bed. (2am and school tomorow. >.< ) If I don't fix tonight, I will try tomorow.

Wow your dedicated xD
Good to know your extension means more to you then school :D
  • 0

#31 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2758 posts
  • Version:GM:Studio

Posted 01 December 2008 - 08:47 AM

Haha, yeah well my school is evil so... :)

I know the feeling bro, I've got class in about 5 hours (its actually 4am here) and I've yet to sleep =)

DANG! Good luck with classes tomorow. :D

Anyway, I think I have managed a fix, since I didn't get the error myself, I am not sure if it fixed it or not. (Though theoreticaly it should have) Hope it works for you guys. 'Night.

Edited by Scyler_27, 01 December 2008 - 08:48 AM.

  • 0

#32 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 09:01 AM

Oh boy =/
It made loads of objects have unitilised variables for some reason, made worse i think xD
  • 0

#33 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 09:12 AM

Seems to have solved all the errors I was getting. Weird.

Time for me to get some sleep. nite folks

Edited by bocochoco, 01 December 2008 - 09:12 AM.

  • 0

#34 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 09:24 AM

Hmm, with the coordinate change the positions are not precise heres a picture where each light is meant to have a lighting effect which somewhat varies it's position.

Also something I call bloopers, the lights which appear and don't go away :)

[IMG Edited]

Edited by Krisando, 02 December 2008 - 09:20 PM.

  • 0

#35 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2758 posts
  • Version:GM:Studio

Posted 01 December 2008 - 03:59 PM

Krisando, your version of Game Maker is screwed. :lol:I dnow WHAT is going on with you, 1. I never changed coords or sprite origins. It loads the "built in" sprites externally which are 256x256, and puts the origin at 128x128. There is NO possible way for it to have changed unless you managed to do it yourself. I have loaded the example and messed with it on a DIFFERENT computer that I am NOT making the .gex with and it is still working fine, no errors. Could you tell me if the v3.0 example works properly?

EDIT: Hm.. I just noticed that it isn't changing the light shape if you change it under light_set_light(), I will have to look into that later, I am at school.

Edited by Scyler_27, 01 December 2008 - 04:05 PM.

  • 0

#36 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 09:15 PM

Kris, I had a similar problem before with moving objects and the lights lagging behind them. I figured out how to fix it. its actually quite easy. Code below for a flashlight following the player

[codebox]if keyboard_check_pressed(ord("W")) yspd-=10;
if keyboard_check_pressed(ord("S")) yspd+=10;
if keyboard_check_pressed(ord("A")) xspd-=10;
if keyboard_check_pressed(ord("D")) xspd+=10;
if keyboard_check_released(ord("W")) yspd+=10;
if keyboard_check_released(ord("S")) yspd-=10;
if keyboard_check_released(ord("A")) xspd+=10;
if keyboard_check_released(ord("D")) xspd-=10;

var pd,xx,yy;
pd = point_direction(x, y, mouse_x, mouse_y);
xx = x+lengthdir_x(0, pd) + xspd;
yy = y+lengthdir_y(0, pd) + yspd;

light_set_light(flashlight, xx, yy, 512, lt_normal, spr_flashlight, pd);
[/codebox]

Basicly it takes the movement speed into account when updating the location of the lights.
  • 0

#37 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 09:27 PM

*Click* Thankyou =] that also helped with another bug.
  • 0

#38 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 09:48 PM

Great, glad it helped out.
  • 0

#39 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2758 posts
  • Version:GM:Studio

Posted 01 December 2008 - 11:06 PM

Ok guys, I hope I was able to fix some problems with this minor update! This is what I did:
1. Removed the light_set_light() and light_colorset_light() functions! It is done automatically for you now.
2. Speeded up the positional lighting, so lights SHOULDN'T lag behind objects anymore, or at least less than it did.
3. I hopefully removed the undefined error, and made it more efficient. Please tell me if you get the error, because I never got it so I can't really know if my "fix" worked.
4. I added another argument in light_main_set() so you can turn colored lights on or off manually! (If you don't ever call this function, the colored lights are automaticaly turned off)

That is about it, please say if the example works smoothly or not!

EDIT: Coming across more problems with the lights... I am going to have to look into this... AGAIN.

Edited by Scyler_27, 02 December 2008 - 12:33 AM.

  • 0

#40 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 02 December 2008 - 12:07 AM

I will give you feedback once there is a working link. You'll fix it. You've fixed everything else so far.

edit: 100 posts!

Edited by bocochoco, 02 December 2008 - 12:07 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users