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.

AppGameKit Studio Chat / [SOLVED] Rotating a sprite around a specific point

Author
Message
Bluepixel
4
Years of Service
User Offline
Joined: 8th Apr 2019
Location:
Posted: 17th Apr 2019 14:58
Hi there, im making a super hexagon type game and im not sure how to rotate my player sprite around a specific point

The author of this post has marked a post as an answer.

Go to answer

Kevin Cross
20
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 17th Apr 2019 15:51
This post has been marked by the post author as the answer.
Just googled the game, that game looks crazy. It looks like it's actually rotating around a circle (even though the hexagon is in the center). I haven't got any code at hand but have done it in the past. It uses sin and cos and can normally be done on one line of code. Maybe search for sin or cos in the forum to see if there's examples.
OryUI - A WIP AGK2 UI Framework
Kevin Cross
20
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 17th Apr 2019 16:13 Edited at: 17th Apr 2019 16:15
Found an example in one of my old threads



The first number before the multiplier (50) is the distance from the centre. And the other numbers 512 and 384 is where the centre point is. I chose the middle of the screen.

The angle line keeps it facing a particular way. You will need to place an image on it like a triangle and play around with the angle to make sure it's facing the right way etc. It should be a good starting point if you want to add this to keys or touch to move the sprite around the circle.
OryUI - A WIP AGK2 UI Framework
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 17th Apr 2019 18:42
if you know the point to rotate around you could also change the sprite offset to that point before you rotate
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
Bluepixel
4
Years of Service
User Offline
Joined: 8th Apr 2019
Location:
Posted: 19th Apr 2019 10:24
Thanks a lot

Login to post a reply

Server time is: 2024-03-28 23:29:08
Your offset time is: 2024-03-28 23:29:08