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.

DarkBASIC Professional Discussion / 2D enquiries. Please Help

Author
Message
old rinkly
22
Years of Service
User Offline
Joined: 11th Mar 2004
Location: Devon UK
Posted: 12th Feb 2012 22:24
Hi All,I do a lot of 2D programming, So I would like a little help in this subjact please.

At present I am working on an animation where a flock of birds on the ground, fly up and away when startled.
As the birds fly up then turn right, the turn is too sharp and artificial, is there a way to make the turn more of a curve ?

Many years ago in (Amos) there was a command (come to), to make a sprite move to a defined X,Y point.
Is there anything in DBP that does the same thing ?

Old Wrinkly

old rinkly
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 13th Feb 2012 05:40
you have many options:
using matrix1utils_7 where you can create curve.

using logarithmic function.
using second degree equations.

or the easiest, DBpro core commmands:
newxvalue
newzvalue (not newyvalue for 2D)
old rinkly
22
Years of Service
User Offline
Joined: 11th Mar 2004
Location: Devon UK
Posted: 13th Feb 2012 12:54
Thanks basjak. I will see what I can Do. Cheers. Old Wrinkly

old rinkly
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Feb 2012 13:29
I'd just have a float as the X speed of each bird, then increment the position based on the speed, and increment the speed each loop as well. That way, you could start the takeoff and set the speed to a small value, randomly - so the birds take off in a random X velocity, then smoothly start flying to whatever direction, just by incrementing the speed and limiting it.

You could have the birds head towards a direction, but you probably don't need that, just have them take off and fly to the right, out of screen. You could use Atanfull, and distance checks, or vectors to have the birds head towards a target location, but that might only be relevant if they do more than just fly away. For example, you could have birds attacking other birds, or swooping at the player.

It can also depend on how you handle your birds. If you have a particle system, then I'd just have a bird as a unique particle, and let the particle system take care of it. I've used particle systems for this sort of thing before - last time it was a moth that circles around light sources, then if the player destroys the light source, the moth chases the player instead. It was real easy to bolt the moths onto the particle system, and saved having to control all that seperately.

Health, Ammo, and bacon and eggs!
old rinkly
22
Years of Service
User Offline
Joined: 11th Mar 2004
Location: Devon UK
Posted: 13th Feb 2012 22:07
thanks Van B,Gives me a bit to work on.
It's funny how you work on a main animation,then a small part gives you a problem, so you make a mini program to work on the problem, etc etc etc..At 82 I think its time to give it a miss. Cheers. Old Wrinkly.

old rinkly

Login to post a reply

Server time is: 2026-07-10 10:42:15
Your offset time is: 2026-07-10 10:42:15