Vector Add?

Game Editor comments and discussion.

Vector Add?

Postby Toasterman » Sat Jul 09, 2011 2:35 am

I'm back! With a question!
My computer crashed (losing all my GE stuff) and after a few months of depression I've picked up Game Editor again!

So to the point: how does vector add work? There is no data entry in the script reference and I found a whole lot of nothing via the search.
What is it? What is it useful for? Dissect the code itself (what's up with those one symbols -&- anyway?) Any information would be good.

What I'm wanting to do with it is make my own path system for enemies- specifying several coordinates and having an enemy follow the path nodes. I'd hoped that the vector add function might make the enemy's path "smooth out" and sorta round off the corners of the path, so it isnt so rigid.

Any help appreciated :D
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: Vector Add?

Postby jimmynewguy » Sat Jul 09, 2011 3:08 am

Documentation:
vectoradd: Adds vector2 (angle2, magnitude2) to vector1 (angle1, magnitude1) and returns the result in vector1 (angles in degrees).

Example:
http://game-editor.com/examples/vectoradd.zip

Attempt to explain:
So basically you add vectors (aka angle and direction). Not sure how to explain the &, it's pretty much just how you state it with vector add.

Code: Select all
vectoradd(&angle1, &velocity1, angle2, velocity2);


Explanation on vectors maybe will help? http://www.physicsclassroom.com/class/vectors/u3l1b.cfm

Sorry I'm not very good at explaining things. If this doesn't help at all just let me know and I'll try to explain again. :lol:
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest