Drawing triangles issue

E

Edeyz

Guest
I'm trying to create shadows for an object in my game. This object ALWAYS faces the center of room, which is where the player is.
For the center of the room I use the variables:
global.centerPointX
global.centerPointY

The object has the dimensions
X 500
Y 50
It is also a rectangular block

I use 2 events that are associated with the shadows:

A step event:
//Directs shadow
directionXYNegitive = point_direction(global.centerPointX, global.centerPointY, x + 250, y - 25);

directionXYPositive = point_direction(global.centerPointX, global.centerPointY, x + 250, y + 25);

The second event is the draw event:

draw_triangle(global.centerPointY, lengthdir_X(1000, directionXYNegitive), lengthdir_y(1000, directionXYNegitive), lengthdir_X(1000, directionXYPositive), lengthdir_y(1000, directionXYPositive), false);
draw_set_alpha(0);
draw_triangle(global.centerPointX, global.centerPointY, x + 250, y - 25, x + 250, y + 25, false);
draw_set_alpha(1);
draw_self();

I want this to draw 2 triangles, the first been the shadow, from the center of the room and out past the object. The second to remove the shadow from the front of the object.
What it does do is create many long thin triangles from the shapes, that only appear on the upper left portion of my screen (and few on the Lowe left just below the center)
For now I'm not concerned with the second triangle and so have set the alpha to 0;

If any of the variables or anything has inconsistent spelling this is because I have no home internet where I live, and can't tether because I need to be outside to use my phone. All the code here has been retyped on, and sent from my mobile.

Thank you
Edeyz
 
Top