Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 5th Mar 2013 23:28 Edited at: 5th Mar 2013 23:31
How can I make a sprite orbit the mouse? Had a nifty idea, although I'm stuck on how I can get this to work. I'm guessing it has to do with some clever maths? I tried messing around with the sin, cos and tan values of a variable and placing the sprite at the mouse's position +/- the value of that 'equation'. Something along the lines of:


I have a variable which I simple use like a form of 'for' loop in the do/loop:


I have attached a VERY primitive picture showing what I want to acheive

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Mar 2013 23:40
Try using a Revolute joint about an invisible sprite to get the visible one rotating about the invisible one.

Then make a Mouse joint between the invisible sprite and the pointer.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 5th Mar 2013 23:56
Ahhhhh!! thanks! Can't beleive that I didnt think of that ._.
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 5th Mar 2013 23:57
Ahhhhh!! thanks! Can't beleive that I didn't think of that ._.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 7th Mar 2013 19:36
Or do this...



I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 7th Mar 2013 23:00
or this...

..and not use circle maths at all
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 8th Mar 2013 15:45
Thanks! to both of you, I think I'll use the non-maths method, seams to be simplest to control.
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 9th Mar 2013 21:43
+ to Marl since that would ensure the face of the moon visible to earth wouldn't change. Keep it real

I would also like to point out however, in all fairness to reality, that the moon's orbit is elliptical

My hovercraft is full of eels
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 11th Mar 2013 19:46
My code handles that.

Change the values of Size# in the x and y statements to different numbers to create elliptical, or even figure 8 orbits. (Or wavey ones, or crazy ones, or see saw ones lol)

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]

Login to post a reply

Server time is: 2024-05-03 14:15:28
Your offset time is: 2024-05-03 14:15:28