OZONE Asylum
Forums
Multimedia/Animation
*poke* Hey Grumble
This page's ID:
11342
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Yeah. It's suppost to be that way. When I was in Taiwan, we visited a reasturant that was on the 47th floor of a skyscraper. The elevator on the 47th floor to go back down had light indicators for up and down that were just boxes without arrows. I said to myself "Hell.. Everyone knows that lights have to mean something.. There's a light on top and bottom. Who needs arrows to make you feel stupid??" Inspiration.. The purpose of this project will be, eventually, to make these little "flies" behave like little AI thingies. Look at the stationary fly and check out how the middle turns red depending on where your mouse is (relative angle). Okay. So assume that the grey line (the 100% spot so to speak) is the direction that the fly wants to move all the time. So I'll get it pretty soon so that the "fly" randomly turns about spasticly, and fluctuates its speed of movement. And then, depending on how accurate it's aim is to it's target (by percentage), a number will be added to the fly's current unstable speed every frame. So, for example, if I made the target a picture of a lightbulb, and i set it's 'love' of the target to zero, it would fly around aimlessly, and depending on the initial speed it may fly off the screen. If there is a value to 'love', the fly would still fly around aimlessly, but miraculously always find its way towards the light which it now loves to be around. Got it? No? Here's the process broken down. (I need practice. I'm turning this into my graduation project.) [b]initial[/b] = [b]5[/b] //How fast this fly would move all the time if there were no other factors (distance in pixels) [b]love[/b] = [b]5[/b] //How much this fly loves light (distance in pixels) [b]buffer[/b] = [b]50[/b] //umm.. the lack of accuracy needed to make some sparks An Example: So let's take a single frame. The first step is to pick a tiny random number (ex: 1-10) to add or subtract to the current angle, which could be one more than [u]zero[/u] this time for the sake of simplicity. So if our random number turned out to be 4. 10/2 is 5 to split the number evenly to right and left. so 4-5 is -1. And you all know 1-1 = 0 duh Alright! Now we're pointing towards 0! Exciting... So then a lot of trigonometry comes in (blah blah blah) and we figure out the angle of the target relative to [zero]. Let's assume that [zero] points right like on a protractor. So if our target (the mouse) is directly 45º from zero (meaning counter-clockwise) we get a [b]percentage[/b] value of 50%. Why? [b]Buffer[/b] is set to take up 50% of the polar plane. So that means that 0% [i]starts[/i] at 90º.. Following yet? [Zero] is the hot spot; it's 100%. Right. Blah. 90º = 0%, 0º = 100% so that must mean that 45º = 50% right? RIGHT!? So [i]finally[/i].. if the [b]love[/b] is equal to [b]5[/b], and the [b]percentage[/b] ends up at [b]50[/b], we just take 50% of 5, meaning 2.5 and add that value to the initial speed making a whopping... 7.5 pixels. So these flies do this boring kind of thing over and over and over about twelve times every second. Fun eh? [b]laziness[/b] might be added later for realism. If the fly is over it's target, it might just stay there for a few seconds or more, and then fly around a bit more.. and then sit some more...That is unless you wave you're mouse around at it! Shoo fly! [url=http://www.osysi.net] [img]http://www.osysi.net/files/sigs/bmud_greatwall.gif[/img] [/url] [b]Shine and shine.[/b] [This message has been edited by Bmud (edited 07-28-2002).]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »