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 Classic Chat / How do I make a sprite move in a sine curve?

Author
Message
Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 11th May 2012 12:24 Edited at: 11th May 2012 12:43
If I want to move a sprite around a sine curve like a moving in a eight laying down. How do I do that?

In Tier1.

I do something like this but it does not look like a 8.



Keep track of your milage and deductions
Get Driver Logbook
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 11th May 2012 12:42
Here's a small code snippet.



Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 11th May 2012 12:46 Edited at: 11th May 2012 12:49
Looking good Hodgey.

And if I want it to go back to the left like moving in an eight laying down??

I do something like this but its jerky



Keep track of your milage and deductions
Get Driver Logbook
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 11th May 2012 13:20
I was able to do this but the 'reflection' is a bit jerky. It's more like a bounce than a smooth figure 8. I just negate the sin function when going 'backwards'. If you need something more elaborate then I can keep trying, but it might get a bit complex.



Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 11th May 2012 13:28
Thanks Hodgey!

Keep track of your milage and deductions
Get Driver Logbook
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th May 2012 13:43
It's simpler than you think:


Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 11th May 2012 13:51
Very nice baxslash! It amazes me what you can do with a timer.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th May 2012 14:03
The first few lines in my loop almost always look like this these days:


I use them for all sorts of things

Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 11th May 2012 14:06
baxslash, you should make a small guide on the use of timers, if you have not already.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th May 2012 14:15
Around halfway down. For some reason it's not been added to the new news area yet...
http://www.thegamecreators.com/pages/newsletters/newsletter_issue_111.html

Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 11th May 2012 14:17
Nice job baxslash as allways.

Keep track of your milage and deductions
Get Driver Logbook
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 11th May 2012 14:23
I knew I had seen something about it, but I could not recall if it was your excelent work, so it was.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th May 2012 14:27
Glad to help!

Login to post a reply

Server time is: 2024-11-23 10:47:07
Your offset time is: 2024-11-23 10:47:07