Radar Tutorial

Radars are few of those things which can be used in almost every game , specially when there are both horizontal and vertical scrolling , making such a game without a radar can be a bit irritating for the player. In my latest game where both horizontal and vertical screen moves were there , i used to look at the radar after every 15 seconds to check out the current enemy position and it really helps for sure. Again like my previous Article , an engine for this thing is available too but not much peoples know about that & others may be trying to search for its tutorial in the articles section , on either condition , here goes an article.

Basis:
1)We setup two dots of different colors or any two other objects which will indicate both good groups and bad groups in our radar , or lets say Blips in short

2)We bring them at the position , where our Radar is in the playfield and then divide them in such a way that they move in the Radar Box according to the good/bad group objects moving in the playfield.

Level Editor:
1)Create two dots ( or any other two objects ) for both good and bad groups which you'll use as Blips for good/bad objects in the playfield. Open its 'Object Preferences / Extra' and uncheck 'Follow the playfield'. This is because the good/bad blips dont get left behind in the playfield while our objects are making horizontal or vertical moves with changing screen centres

2)Create a Radar Box of 'Any' size you want ( 50x50 for reference ) and bring it to the upper right corner of the screen. Do the same with the Radar Box ( uncheck its 'move with playfield' property )

Events Editor:
1)Always:
A)Set X Position of the 'Good Blip' to X(Good.Object.Name.Here) / 20 + X(Radar.Object.Name.Here) - 13

B)Set Y Position of the 'Bad Blip' to Y (Bad.Object.Name.Here) / 20 + Y(Radar.Object.Name.Here) - 7

Explanation:
In Line A first we set the position of the Good Blip ( Blip for good object ) to the position of the Good Object in the playfield divided by 20. It was divided by 20 considering that the size of the Radar Box at the upper right corner of your screen is 50X50 and the total size of your playfield is 1000X1000. So divided 1000 By 20 to get 50 ( x,y Radar Box Size ) OR Multiplied 20 by 50 to get 1000 ( x,y Playfield size ) , this way you can find out the correct value to use for the division.
After doing that we have added + X(Radar.Object.Name.Here) to bring the Good Blip within the Radar Box and additionally we have added -13 to speed up the blips moving within the Radar Box , to further adjust within it. Addition of + Y(Radar.Object.Name.Here) - 7 for the Y position of the blips does the same job.

In Line B , we perform the same steps as above , only we have now worked with the Bad Blip and Bad Object.

It will look something like this , you can take it for reference:
Image

Testing Your Radar:
To check out what you've just made , add path movements for both good and bad objects and centre display at one of them. And Run It!

Additional Stuff:
There are few additional things you may need to add to your radar , like if you are planning to get your in-game radar work like a real moving radar where blips are displayed just for few seconds and vanish temporary till the radar is refreshed then read A. If your game have multiple good/bad objects whose numbers are beyond your control or say you don't know how many good or bad objects will be created during the game then skip to B.

A)To do this you will simply put a Horizontal line in the Radar Box and add looping path movement in it which takes the line down to the bottom of your reactangle Radar Box and then loops the same movement.
Make your Normal good/bad blips invisible at the start of the level. Add two new clone good/bad blips where the actual blip frames are in an Animation sequence other then the Stopped one ( take animation Walking for reference , with 10 same frames of the actual blips and 25 speed for both min and max ). You can just put a Dot or anything you like for the Stopped animation sequence because those blips will be kept invisible unless animation Walking is playing. Now set these Events in the Events Editor:
*Start of level: Make good/bad blips invisible
*Always + Animation Walking for Good/Bad Blips Clone is not playing: Make Good/Bad Blips Clone invisible
*Always + Animation Walking for Good/Bad Blips Clone is playing: Make Good/Bad Blips Clone visible
*Horizontal Line collides against Good/Bad Blips: Set position X/Y of Good/Bad Blips Clones to X/Y Position of Good/Bad Blips and change animation sequence of Good/Bad Blips Clones to Walking.

This will make your Radar act like a realistic radar. You can further modify it to look even more realistic. Try it now before you continue..

B) If the number of Good/Bad objects moving in the playfield are random then simply assign Group.Good and Group.Bad groups to both Good and Bad groups respectively. In the events editor set the follow events:
*If number of Good Blips is less than Good Objects moving in the playfield: Create a Good Blip At 0,0
*If number of Bad Blips is less than Bad Objects moving in the playfield: Create Bad Blip At 0,0
*If number of Good Blips is greater than Good Objects moving in the playfield: Destroy Good Blip
*If number of Bad Blips is greater than Bad Objects moving in the playfield: Destroy Bad Blip

This will keep on adding/removing blips from the radar according to the good/bad objects moving in the playfield. Everytime the number of blips of a particular group in a radar becomes greater or less than the number of that group objects moving in the playfield then the Radar will keep on creating/destroying blips accordingly.

End Of Tutorial

If you have understood the working of the Radars given above completly , then you can further modify them to make a totally custom Radar.

Hope it helps