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 / Moving Sprites on a Curve/s has me totally upside down

Author
Message
GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 13th Mar 2020 14:24
Hi,
This is hopefully easy for a lot of you. It could create some interesting stimulating discussion. (may be?)
I have been long "mystified" with some sprite moving techniques. I have invested a lot of hours trying to figure things out to no avail. I can move sprites in all directions and in all formations (as in space invaders etc). I can move them and also rotate them at the same time, either with or without offset. I have spent a lot of time with interpolation and Bezier curves. As a separate issue for me, I can make "free curves", as in S curves etc using the Bezier curve formulas/formulae (which one is correct?), but I cannot figure out how to make a sprite follow the curve created.
And then again, I am not sure this is the right approach.

How do they do the sprite movement as indicated in the following links?
The early 80s Galaga game
https://www.youtube.com/watch?v=dvjapcHsqXY&t=195s
The 1982 AppGameKit game. You can see the particular sprite movement at about 55 seconds. The figure eight and or random curve movement. The rest of the stuff with bouncing of the walls etc, I can do with some work.
https://www.youtube.com/watch?v=zyhwHEsQJcM

Well, help, suggestions, ideas and what not, are WELCOME!
Cheers!
Mesher
User Banned
Posted: 13th Mar 2020 14:41 Edited at: 13th Mar 2020 14:42
Maybe useful to take a look into CreateTweenSprite and CreateTweenChain and all the other lovely Tween commands available - i did something with tweens long time ago and worked well.


GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 13th Mar 2020 15:33
@Mesher, You know, I have looked at "tweening" briefly and didn't seem at the time that was an avenue which could bring solutions. Now, I am on it again, and see where I get. Thanks and
Cheers!
Mesher
User Banned
Posted: 13th Mar 2020 15:55 Edited at: 13th Mar 2020 16:16
Unless you create your own method

by using an array of paths points using the X/Y coords in an array and move the sprite to each point in turn in that array.

If ya know my meaning.

Ill see what i can do after work. I can quickly knock something up for you to take a look at.

EDIT

Something like this


Moves a sprite along points thats been added to an array - this creates a set of points in a style of a clock.

Or this creates a style of a figure of 8



Hope this helps for now
GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 13th Mar 2020 16:25
@Mesher. Awesome! I will look at it shortly. Should you take the time to add more then...
Cheers!
Mesher
User Banned
Posted: 13th Mar 2020 16:26
This creates a snake.



Have fun...
GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 13th Mar 2020 16:31
@Mesher
BTW if you are new to the community..WELCOME!!!!
Glad to have you!
GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 13th Mar 2020 17:07
@Mesher,
Sometimes we get involved in a project with the wrong approach and we fail to see the simple solution, or portion of it. So, we get stuck deeper and deeper in code and never get anywhere.
Today I decided to stop working on Interpolation, both linear and circular, along with Bezier curves, sit back, catch up a bit on my sleep and ponder. Yes,stupidity abounds!
Then, the light bulb lit up. Quit being stubborn and ask for help! Help is an amazing thing!
I should have done it about 80 hrs of code writing earlier!
You gave me plenty to get started!
I am ever so Thankful!
Cheers!
Mesher
User Banned
Posted: 13th Mar 2020 18:02
Its always useful to see how others would acheive things. Thats how we learn new ways of doing things.

Your more than welcome, hope you find this technique useful.

It can be useful for many things:-

Asteroids
Centepede
Snake

or anything similar


GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 13th Mar 2020 18:34
@Mesher. Roger that!
Thanks again!
Cheers!
Mesher
User Banned
Posted: 13th Mar 2020 18:38
My version of a Beizer in AGK



Its rubbish i know

Increase the N in the function from 4 to what ever for detail

Line 42


blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Mar 2020 20:35 Edited at: 13th Mar 2020 20:35
I did an experiment with a galaga game once. I found the simplest way to control the movement was with a string of instructions (S-Straight, L-Left, R-Right) with an accompanying distance or angle. Not super accurate but it worked out ok for me.

Attachments

Login to view attachments
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 14th Mar 2020 05:46
Generally speaking the "Paths" that Enemies had in Old School Shoot 'em Up Games was essentially a hardcoded Formula.



This would be considerably easier if AppGameKit Studio didn't deprecate EnableClearColor( ) function, which let's you disable "Clear Screen" but then I have a sneaking suspicion that their Vulkan implementation doesn't utilise the ImageBuffer to switch between RenderBuffer and VkImage.
While the Memblock Peformance is frankly abysmal it's good enough for what we're doing here.

That is to showcase the Animation of Movement.
Now remember, if you want to create a Circle then you'd use COS instead of SIN on one of the Axis... it's common practice to use COS(X) and SIN(Y) but really it actually doesn't matter which way around you do it.

If you ever watch the Movement Patterns in the old Games, you'll see they're creatively using simple formula like this (usually pre-calculated in a Look-Up Table... i.e. an Array) that gives their Enemies all that sweeping Movement; and because with CosSine approach you get more points in smaller arcs, this actually provides the illusion of an enemy slowing down and speeding up.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 14th Mar 2020 07:34 Edited at: 14th Mar 2020 07:36
pathpoints is one way and I personally think the formula way is the best
but I started work with the path point method here with an editor https://forum.thegamecreators.com/thread/221096
edit Allows you to draw any path you want the enemy to take

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 16th Mar 2020 20:27
Excellent responses from all of you!!!
Much appreciated!
Cheers!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 16th Mar 2020 20:36
Sorry. Forgot to attach the project to my post

Attachments

Login to view attachments
GreekToMe
14
Years of Service
User Offline
Joined: 27th Oct 2009
Location: Colorado
Posted: 16th Mar 2020 20:58
A welcome add on . Thanks!
Cheers!

Login to post a reply

Server time is: 2024-04-26 21:49:38
Your offset time is: 2024-04-26 21:49:38