T
TheOakNuggins
Guest
Currently I am drawing a shadow at my player object's coordinates. This doesn't look to good when you jump in the air. So I have a few questions.
1Q.a) How should I go about creating a system that will draw the shadow on whatever object is underneath the player. This way you can jump and still see the shadow underneath you (like in Mario 64)
1Q.b) Can this be scaleable so that the shadow shrinks by an adjustable factor when in the air. (i.e. out of 1, 1 would be touching the ground, full shadow. 0.1 would be at max jump height).
2Q) Is there any way to rotate it when walking up a slope? I mean to transform-rotate it where the pixels don't rotate, but the sprite is shifted into a tilted image
How I check for ground:
Attatched image is how it currently looks.
1Q.a) How should I go about creating a system that will draw the shadow on whatever object is underneath the player. This way you can jump and still see the shadow underneath you (like in Mario 64)
1Q.b) Can this be scaleable so that the shadow shrinks by an adjustable factor when in the air. (i.e. out of 1, 1 would be touching the ground, full shadow. 0.1 would be at max jump height).
2Q) Is there any way to rotate it when walking up a slope? I mean to transform-rotate it where the pixels don't rotate, but the sprite is shifted into a tilted image
How I check for ground:
Code:
//check for ground
if (place_meeting(x, y+1, oSolid)) and (jkey) {
vspd = jspd;
}
if jkeyrelease {
vspd += 1.5;
}
Code:
//CREATE EVENT:
solidxScale = sprite_width;
solidyScale = sprite_height;
//DRAW EVENT:
draw_sprite_stretched(sSolid, 0, self.x, self.y, solidxScale, solidyScale); //draws sprite going to mask
gpu_set_blendenable(false) //turns colors off
gpu_set_colorwriteenable(false,false,false,true);
draw_set_alpha(0);
draw_rectangle(0,0, room_width,room_height, false); //draw a large rectangle to be drawn on
draw_set_alpha(1); //draw masking alpha
draw_sprite_stretched(sSolid, -1, self.x, self.y, solidxScale, solidyScale);
gpu_set_blendenable(true);
gpu_set_colorwriteenable(true,true,true,true);
gpu_set_blendmode_ext(bm_dest_alpha,bm_inv_dest_alpha); //colors back on
gpu_set_alphatestenable(true);
draw_sprite(sPlayer,0, mouse_x,mouse_y); //draws covering mask
gpu_set_alphatestenable(false);
gpu_set_blendmode(bm_normal);
Last edited by a moderator: