The Daily Click ::. Downloads ::. Tutorial ::. MMF2 - Angle Detector for Vector Movement
 

MMF2 - Angle Detector for Vector Movement
Author: Strife Submitted: 29th September, 2010 Favourites:0
Genre: Tutorial Downloads: 508
Rated:


Edited By Strife on 9/29/2010

If you've ever played around with MMF2's built in Vector Movement, you'll know that you can't make Vector objects bounce against surfaces unless you manually input the angle of the surface. This means that you'll have to waste extra resources by making all of your surfaces active objects with their own specific angles.

Well, not anymore! This tutorial shows you how, with a little bit of trigonometric ingenuity, you can automatically detect the angle of backdrop surfaces. Keep in mind, it's somewhat rough, but with a bit of tweaking, you should be able to adjust it for objects of different sizes and shapes.

Credit is not needed. I'm just so happy that I got it working finally so I can share it.

Review This Download



 


http://games.galaxytrail.com/vector_angledetector.zip (15kb )



Posted by Hagar 30th September, 2010

Nice example - I have done this myself a couple of weeks back. Using a little state machine you only need one active object as you can detect the backdrop and then detect not being on the backdrop. On coming out of the backdrop you can then break the loop, and you have the two XY locations and hence you can work out the normal (that angle +90). I will be OS this part of the code upon releasing my game
Comment edited by ..::hagar::.. on 9/30/2010
 
Posted by Strife 30th September, 2010

Suh-wheat! =D I was kinda wondering if anyone else had done something similar with the Vector movement. It definitely saves you some hassle, and it essentially works like a 360-degree Bouncing Ball movement.
 
Posted by Pixelthief 1st October, 2010

Oh hah I had never even seen this. This is the same algorithm that I've been using for a while now and I have an article posted up about it! You can optimize it by starting it by searching at +-90 degrees from the previously found normal angle- then going until you find the opposite of that positions backdrop status.
 

 



Author

Favourite



Advertisement

Worth A Click