So go from This:

To this:

In the draw event (also, my sprit is scale using imagey_scale). Is it possible?
Edited by GraphicGamer, 04 May 2011 - 04:18 PM.
Posted 04 May 2011 - 04:16 PM


Edited by GraphicGamer, 04 May 2011 - 04:18 PM.
Posted 04 May 2011 - 04:32 PM
Edited by Nocturne, 04 May 2011 - 04:32 PM.
Posted 04 May 2011 - 04:39 PM
You would have to use a primitive and then texture it with the sprite. Once that is done you can manipulate the corners of the primitives to create the effect you desire. Check out the draw_primitive(), and sprite_get_texture() codes for more information (hint : with two triangles you can do this).
Posted 04 May 2011 - 04:48 PM
tex = sprite_get_texture(sprite, ind); //get the sprite as a texture tex_h = texture_get_height(tex); tex_w = texture_get_width(tex);
draw_primitive_begin_texture(pr_trianglestrip, tex); //start the primitive...[b] [/b]draw_vertex_texture(0, 0, 0, 0); First corner - upper left draw_vertex_texture(32, 0, tex_w, 0); upper right draw_vertex_texture(0, 32, 0, tex_h); bottom left draw_vertex_texture(32, 32, tex_w, tex_h); bottom right draw_primitive_end(); //draw the primitive...
Posted 04 May 2011 - 05:27 PM
Okay, but I´m in a bit of a hurry so I´ll briefly explain and hope you get it! In the create event
tex = sprite_get_texture(sprite, ind); //get the sprite as a texture tex_h = texture_get_height(tex); tex_w = texture_get_width(tex);
Then in the draw event...draw_primitive_begin_texture(pr_trianglestrip, tex); //start the primitive...[b] [/b]draw_vertex_texture(0, 0, 0, 0); First corner - upper left draw_vertex_texture(32, 0, tex_w, 0); upper right draw_vertex_texture(0, 32, 0, tex_h); bottom left draw_vertex_texture(32, 32, tex_w, tex_h); bottom right draw_primitive_end(); //draw the primitive...
Now the codes above should draw a square textured primitive... to change how its drawn change the coords for the corners.
I hope that helps!
draw_set_color(c_white) draw_primitive_begin_texture(pr_trianglestrip, tex); //start the primitive...[b] draw_vertex_texture(x-((tex_w/2)-24),room_height/2,0,0) draw_vertex_texture(x+((tex_w/2)-24),room_height/2,tex_w,0) draw_vertex_texture(x-67,room_height, 0, tex_h) draw_vertex_texture(x+67,room_height,tex_w,tex_h); draw_primitive_end(); //draw the primitive... draw_set_color(c_black)
Posted 04 May 2011 - 05:57 PM
draw_set_color(c_white);//Not neccessary as we are using a texture... draw_primitive_begin_texture(pr_trianglestrip, tex); //start the primitive... draw_vertex_texture(x-(sprite_width/2)-24, room_height/2, 0, 0); //this may not be what you want but you get the idea! draw_vertex_texture(x+(sprite_width/2)-24, room_height/2, tex_w, 0); draw_vertex_texture(x-67, room_height, 0, tex_h); draw_vertex_texture(x+67,room_height,tex_w,tex_h); draw_primitive_end(); //draw the primitive... draw_set_color(c_black) //again, not necessary..
Edited by Nocturne, 04 May 2011 - 05:58 PM.
Posted 04 May 2011 - 06:24 PM
Okay, you have to understand that the width and height of a texture are based on values from 0 to 1... so by adding the tex_w to the x you are only adding 1 onto the coord! Instead you would do...
Hopefully that should work!
PS: as for image_blend use draw_vertex_texture_colour() and set the colour argument to image_blend or the colour you wish...
Posted 04 May 2011 - 07:43 PM
0 members, 0 guests, 0 anonymous users