• 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!

[Solved] Cant seem to get my sprite to rotate

F

ferds814

Guest
Code:
with(oplayer){
//lots of script//
/*movement and the rotate function//
 inst = global.markers[0];
                mp_potential_step_object(inst.x,inst.y,spd,oCparent);
                show_debug_message("direction: "+string(direction)+"  angle: "+string(image_angle));
*/ extra code//
/*final in script//
image_angle = direction;
*/
}
wtfdirection shows my debug menu says everything should be rotating. and msk shows my current masks on the sprites. msk1 is me messing around with the sprite in order to get it working. too no avail. will post edit with one of my working ones.



wtfdirection.PNGmsk.PNG msk1.PNG

Here is my full code on player movement inside a player object in another game, plus pic

Code:
///move
if global.Drive == 0{
if place_meeting(x,y,collisionP_obj){
    y-=2;
    direction += 30;
    if device_mouse_check_button(0,mb_left){
    y-=2
    }
    }
if device_mouse_check_button(0,mb_left){
mp_potential_step(mouse_x,mouse_y,3,solid);
image_speed = 0.33
//direction = point_direction(x,y,mouse_x,mouse_y);
}
if device_mouse_check_button(0,mb_right){
mp_potential_step(mouse_x,mouse_y,6,solid);
image_speed = 0.66
//direction = point_direction(x,y,mouse_x,mouse_y);
}
if !device_mouse_check_button(0,mb_left) and !device_mouse_check_button(0,mb_right){
image_speed = 0;
}

image_angle = direction
}
msk2.PNG

so i am having trouble getting my sprite in gamemaker to rotate. well all of them really. they turn fine in my other projects but in this one i just cant seem to get my "box" to turn.

**EDIT** thanks to obscene i realized i had used a draw event in my object/s. all is back on track now
 
Last edited by a moderator:
F

ferds814

Guest
Do you have draw code?
i feel stupid.....

Code:
//draw
draw_circle_colour(x,y,sight_range,c_green,c_green,true);
draw_circle_colour(x,y,attack_range,c_red,c_red,true);
draw_sprite(sprite1,0,x,y);

if selected == true{
draw_circle_colour(x,y,64,c_black,c_black,true);
}
 
F

ferds814

Guest
Do you have draw code?
fixed with this

Code:
draw_circle_colour(x,y,sight_range,c_green,c_green,true);
draw_circle_colour(x,y,attack_range,c_red,c_red,true);
draw_sprite_ext(sprite1,0,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha);

if selected == true{
draw_circle_colour(x,y,64,c_black,c_black,true);
}
 
Top