Jump to content


Photo

Rotate sprite anti-clockwise


  • Please log in to reply
6 replies to this topic

#1 raphael1

raphael1

    GMC Member

  • New Member
  • 20 posts
  • Version:GM7

Posted 26 February 2012 - 09:00 PM

I have box sprite which is 400px by 400 px, how do get it to rotate anti-clockwise using a timer, being struggling with it for hours.

any help appreciated :blush:
  • 0

#2 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1404 posts
  • Version:GM:Studio

Posted 26 February 2012 - 09:03 PM

if(!timer) {

  image_angle = (image_angle + 1) mod 360

  timer = TIME;

}

timer -= 1;

  • 0

#3 raphael1

raphael1

    GMC Member

  • New Member
  • 20 posts
  • Version:GM7

Posted 26 February 2012 - 09:17 PM

if(!timer) {
  image_angle = (image_angle + 1) mod 360
  timer = TIME;
}
timer -= 1;



Thanks, Does it have to been in a create event?,
  • 0

#4 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1404 posts
  • Version:GM:Studio

Posted 26 February 2012 - 09:58 PM

It goes in the step event.

Edit: but put timer = TIME in the create event

Edited by thegame, 26 February 2012 - 09:58 PM.

  • 0

#5 raphael1

raphael1

    GMC Member

  • New Member
  • 20 posts
  • Version:GM7

Posted 27 February 2012 - 12:10 AM

It goes in the step event.

Edit: but put timer = TIME in the create event


Sorry, what do you mean by timer = timer . should that by in executed scripted?. Sorry if am asking to much question, am really new to this.


It goes in the step event.

Edit: but put timer = TIME in the create event


Sorry, what do you mean by timer = timer . should that by in executed scripted?. Sorry if am asking to much question, am really new to this.


Thanks, I manage to get it working, but how do you get in to rotate in the center, instead of pivot point and change speed as well? Thanks in advance :biggrin:

Edited by xot, 27 February 2012 - 07:42 PM.

  • 0

#6 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1404 posts
  • Version:GM:Studio

Posted 27 February 2012 - 12:43 AM

To rotate it in the center, you have to change the sprite's origin.
As for changing speed...
if(!timer) {
  image_angle = (image_angle + 1 /* Replace this 1 with a higher number or lower the amount of time to make it faster, for slower do the opposite */) mod 360
  timer = TIME;
}
timer -= 1;

Just so you know, this should be on the Novice and Intermediate forum... not the Advanced one... Have you read the GMC rules? It also says a few things about not double posting...

Edited by thegame, 27 February 2012 - 12:44 AM.

  • 0

#7 xot

xot

    media multimixer

  • Global Moderators
  • 4648 posts
  • Version:GM:Studio

Posted 27 February 2012 - 07:52 PM

Hi, raphael1, welcome to the GMC forums!

As thegame pointed out, this topic should have been posted in the Novice and Intermediate Users forum, which is were I have moved it. Also, if you find your self wanting to post twice in row, please edit your previous post rather than "bumping" your topic. We have very specific rules about that. Take some time to look over the Rules forum and the rules of any specific forum in which you wish to post.

http://gmc.yoyogames...hp?showforum=19

I hope you find the GMC forums a useful resource. :)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users