The Daily Click ::. Forums ::. Klik Coding Help ::. Radar
 

Post Reply  Post Oekaki 
 

Posted By Message

BBalazs



Registered
  10/07/2004
Points
  41
20th July, 2004 at 04:16:35 -

How can you create a radar in TGF? Let's say there is a 2D space simulation game, where there is you and there is another spacecraft moving. Is there a way to fit a 'radar' into the top-right or anywhere corner of the screen which shows the relative position of the other aircraft from yours? And to give it a max distance as the marker should not get out of the radar screen...

 
n/a

Zane



Registered
  09/09/2003
Points
  1183
20th July, 2004 at 07:57:27 -

heres a simple way of doing it

first create the box for the radar and put it in the top-right corner. make sure its an active object and the hot spot is in the top right corner. goto object preffrences and un-check the 'follow the playfield' box.
next you need to work out how much smaller the box is from the total size of the playfeild. for example 1/4 the size

now you need to create a small active object to represent the player on the radar. again, uncheck the 'follow the playfeild' box. now go to the events editor.
put an always event.
now set the x-position of the object to represent the player to the x-pos of the player, divided by how much smaller the radar object is, plus the x-pos of the radar object.
for example- (assuming the radar object is 1/4 smaller than the playfeild)
Always --> playermarker x-pos = player x-pos / 4 + radar x-pos

and repeat that step for the y position

you do the same for enemys (having a different marker object on the radar of cause).
to take markers off the radar when an enemy is destroyed you put the following event
if num enemyobjects < num marker objects --> destroy marker

if num enemyobjects > num marker objects --> Create marker


hope that helps. feel free to ask anymore questions about it

Image Edited by the Author.

 
www.klikforever.co.uk
GO THERE!!!

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
20th July, 2004 at 08:02:05 -

there's a tutor on www.tigerworks.co.uk which does what you're trying to achieve (what zane describes actually).

 
www.thenatflap.co.uk

Kramy



Registered
  08/06/2002
Points
  1888
20th July, 2004 at 13:06:15 -

make sure its an active object and the hot spot is in the top right corner

Always --> playermarker x-pos = player x-pos / 4 + radar x-pos

I think he means the hotspot in the top-left corner.

 
Kramy

Zane



Registered
  09/09/2003
Points
  1183
20th July, 2004 at 13:29:05 -

yes top left. *STUPID ZANE*

 
www.klikforever.co.uk
GO THERE!!!

BBalazs



Registered
  10/07/2004
Points
  41
23rd July, 2004 at 06:50:03 -

Thanks! I'll create your version from sketch, but I guess I'll have to find that other one too... Which is the exact name of that tutorial at Tigerworks?

 
n/a
   

Post Reply



 



Advertisement

Worth A Click