Jump to content


carbon28

Member Since 19 Jul 2011
Offline Last Active Jan 17 2012 07:09 PM

Posts I've Made

In Topic: Move to Character problems

21 July 2011 - 11:13 AM

I think the most simple solution is:

speed=2
if(point_distance(x,y,Char.x,Char.y) < 150 and collision_line(x,y,Char.x,Char.y,tower,1,1)=-4 ) {
   mp_potential_step(Char.x,Char.y,speed,0); //move towards the character avoiding all solid objects
   }
else {
     tx = random(room_width);
     ty = random(room_height); //create a random point to move to
     mp_potential_step(tx,ty,speed,0); //move towards the random point
     }
Speed in the first row you can change, it is speed of enemy. And distance (150) change also, 150 pixels is about 1.8 inch/4,7 cm.

In Topic: How Do You Draw Texture Primitives Gm7

21 July 2011 - 09:52 AM

draw_primitive_begin_texture(pr_trianglestrip, background_get_texture(background0));
{
draw_vertex_texture_color(x,y,0,0,c_white,1);
draw_vertex_texture_color(x+10,y,1,0,c_white,1);
draw_vertex_texture_color(x+10,y+10,1,1,c_white,1);
draw_vertex_texture_color(x,y+10,0,1,c_white,1);
}
draw_primitive_end();
For some reason, Game Maker doesn't like drawing plain old vertexes in some circumstances (possibley graphics card related). Using draw_vertex_texture_color(), a slower function, it seems to work.


Note: it draws incomplete square, you need to use not pr_trianglestrip but pr_trianglefan