• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Z-Tilting Lighting Surface Help.??

m0zzy

Member
Ive been messing with the new Z-Tilting effect/feature ..
All was going well untill i wanted to add some lighting effects for my flames
( See Video, ive 2 in front of the main walkway !)
But .. as u can see from the video, not only are they not on top of the 'Flames'
even tho they are on the 'Flames' X + Y ...
Also... they are moving with the camera..
Even tho they arnt connected to the camera in any way ..!
Obviously, this has something to do with the tilting on the 'Camera'
I Just cant seem to find a way to get round the problem ..
Please help ..

Thanks in Advance! :)

VID - https://www.dropbox.com/s/ppmjalywkiho12l/Lights.mp4?dl=0
 
A

Ariak

Guest
Can we see the code where you draw the lights onto the surface and finally draw it to the screen?
My guess is that you are not accounting for the new position of the lights on the surface when you move the camera. A screenspace surface does not have the same coordinates as the room - regardless of ztilting.
 

m0zzy

Member
Usual/standard lighting shader...
if (surface_exists(lightSurf)) {

camera_set_view_angle(view_camera[0], 45);
surface_set_target (lightSurf);
draw_clear (c_black);

// draw the GLOW.!

with(obj_campFire){

gpu_set_blendmode(bm_src_colour);
// draw_sprite_ext( spr_campFire, -1, x, y+z, 1, 1, 0, c_white, .1);
// draw_sprite_ext( spr_campFire1, -1, x, y+z, glowHero, glowHero, 0, c_dkgray, .7);
draw_sprite_ext( spr_light, -1, x, y+z, glowHero-2.4, glowHero-2.4, 0, c_yellow, alpha);
gpu_set_blendmode(bm_normal);
}




surface_reset_target ();

draw_surface_ext(lightSurf, _vx, _vy, 1, 1, 0, c_white, alpha);
// draw_surface (lightSurf, 0, 0,)
// draw_surface_ext (lightSurf, 0, 0,
} else {
// If it doesn't exist than re create it
lightSurf = surface_create (room_width, room_height);

}
 
A

Ariak

Guest
you are not correcting for the cameras position. A surface top-left is always (0,0).
deduct the camera position from the flame when drawing to the surface
 
A

Ariak

Guest
var _camx = camera_get_view_x(view_camera[0]);

Grabs the current x position of the camera, which enables you to decuct it from the x position of the flame. Do the same for y.

draw_sprite_ext( spr_light, -1, x-_camx, y+z-_camy, glowHero-2.4, glowHero-2.4, 0, c_yellow, alpha);
 
Top