Orbit! Help! Orbit around center of screen.
Author |
Message |
Atherial
|
Posted: Mon Oct 05, 2015 9:49 am Post subject: Orbit! Help! Orbit around center of screen. |
|
|
What is it you are trying to achieve?
I am attempting to make a square picture, of bit map format, rotate around the center of my screen.
What is the problem you are having?
Im not sure the equation for a rotation around the center, and any other previous tutorials have not been working, resulting with a static image (When using for statements.)
Please specify what version of Turing you are using
<Using 4.1.1>
I hate to ask for this, without any attempt at it myself, but I have been trying, but nothing ive tried has been near to working- If someone can point me in the proper direction, that would be greatly appreciated. Thanks so much for the help.
-Mackenzie |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Mon Oct 05, 2015 1:53 pm Post subject: RE:Orbit! Help! Orbit around center of screen. |
|
|
There's a number of ways you can do it. You could use the equation for a circle, or you could use physics with velocities, or trigonometry. There are plenty of ways, but ultimately you need to be changing the x and y coordinates of the image inside a loop. Can you get an image to move on the screen at all? |
|
|
|
|
|
Atherial
|
Posted: Mon Oct 05, 2015 4:05 pm Post subject: Re: Orbit! Help! Orbit around center of screen. |
|
|
Yes, Im able to move objects, using loops and view updates, but I dont really know how id do the rest- I understand how to loop and make x's and y's that change within a loop, but ive only been able to make them move in straight lines-
Thanks for the reply, any additional help would be much appreciated!
-Mac |
|
|
|
|
|
Atherial
|
Posted: Mon Oct 05, 2015 4:47 pm Post subject: Re: Orbit! Help! Orbit around center of screen. |
|
|
UPDATE:
Turing: |
View.Set ("graphics,offscreenonly")
var x := maxx div 2
var y := maxy div 2
var xDist, yDist : real %width/height of the circle
var angle : int := 10 %where the little goes around the big circle
var hyp : int := 60
var earth : int := Sprite.New(Pic.FileNew("earth.bmp"))
Sprite.SetPosition(earth,x,y, true)
Sprite.Show(earth )
loop
angle := angle - 1
% trig calculations
xDist := cosd (angle ) * hyp
yDist := sind (angle ) * hyp
Sprite.SetPosition(earth, round (x + xDist ), round (y + yDist ), true)
%Draw.FillOval (round (x + xDist), round (y + yDist), 5, 5, 26)
View.Update ()
delay (5)
%cls ()
end loop
[size= 18]Okay, so I have gotten this far. It spins, It works. . But- How would I change the distance that it spins from- Right now, I have no idea. It spins around the center of the turing default window, and id like it to go further away from the center. Thank you! -Mac [/size ] |
|
|
|
|
|
|
Atherial
|
Posted: Mon Oct 05, 2015 5:07 pm Post subject: Re: Orbit! Help! Orbit around center of screen. |
|
|
Again, figured this out- Changing the number hyp is originally declared as changes it! Thanks!
SOLVED |
|
|
|
|
|
|
|