|
Title: Drawn Objects Collision? Post by: jddg5wa on September 23, 2013, 06:19:24 PM I recently had to rewrite a script in the draw function so that I could have multiple sprites drawn on the object. But now my image rotation isn't working. I've tried to rewrite it in the draw function but it does nothing even though it seems like it should. Is there something I am missing? Thanks for any help! :)
I have the img_angle to equal the image angle but does setting it to 0 at the start of the script keep it at 0? Code: max_angle = 15 rot_speed = 1 img_angle = 0 if keyboard_check(vk_space)=0 or global.bm_nrg<=0 { draw_sprite_ext(Alien_Ship_Sp,-1,x,y,image_xscale,image_yscale,img_angle,c_white,1.0) } //Tractor Beam if global.bm_nrg>0 and (y < 600) and keyboard_check(vk_space)=1 { draw_sprite_ext(Tractor_Beam_Sp,-1,x,y,image_xscale,image_yscale,img_angle,c_white,1.0) } //Alien Controller Left if keyboard_check(ord("A"))=1 { draw_sprite_ext(Alien_Controller,0,Alien_Ship.x,Alien_Ship.y,image_xscale-.05,image_yscale-.05,img_angle,c_white,1.0) } //Alien Controller Right if keyboard_check(ord("D"))=1 { draw_sprite_ext(Alien_Controller,2,Alien_Ship.x,Alien_Ship.y,image_xscale-.05,image_yscale-.05,img_angle,c_white,1.0) } //Image Rotation if keyboard_check(ord("A")) { img_angle+=rot_speed; } if keyboard_check(ord("D")) { img_angle-=rot_speed; } if img_angle=max_angle { img_angle=max_angle-1 } if img_angle=-max_angle { img_angle=-max_angle+1 } Title: Re: Image Rotation and Draw Event? Post by: ink.inc on September 23, 2013, 07:27:51 PM I have the img_angle to equal the image angle but does setting it to 0 at the start of the script keep it at 0? yes Title: Re: Image Rotation and Draw Event? Post by: jddg5wa on September 23, 2013, 07:44:04 PM So... I realized when I tried to use image_angle, instead of the variable I set img_anglel, I forgot to set the draw_sprite_ext image angle to "image_angle". It was set to 0. Forgetting tends to be my biggest problem with programming... but got the rotation working now. ;D Maybe I am jumping the gun just a bit when I ask questions. :P
Though I am still curious if it is possible to declare a variable and have it work in the way I had. _______________________________________________________________ But now I have run into another problem. Since the UFO Sprite is a draw object I can't get any other object to read the collision with the tractor beam. I am not sure why. |