Radar

You must understand the Game Editor concepts, before post here.

Radar

Postby destinydesignlabs » Thu Apr 22, 2010 4:12 pm

Im working on making a game set in the age of intergalatic space travel, and I was wanting a radar on the ship, but I don't know how to do the scripts for it. Basically I was needing the radar to show enemyships when they get close to the ship. Does anyone know how this can be accomplished?
destinydesignlabs
 
Posts: 10
Joined: Mon Jan 04, 2010 5:24 pm
Score: 0 Give a positive score

Re: Radar

Postby Thanx » Thu Apr 22, 2010 5:25 pm

You could have a Filled Region (not wire frame, because that's hallow) around your ship, as big as the range of the radar should be, so when enemies come, they should collide with it, and the collision event should trigger the radar drawing, make sure that the collision event repeats until the actors are out of collision. . The radar could be for instance a background image, with another actor you could call enemyradar. When an enemy is created, have an enemyradar also created, so each enemy actor clone has the appropriate enemyradar actor, with - this way - the same cloneindex as the enemy itself. So on collision with Filled Region the enemy makes its enemyradar visible (at creation its transp should be 1), and here's the hard part.
You need to fixate the width of the region, and the relative positions the incoming enemies may have (from all directions). Mathematically you should figure out how to convert that relative position to the relative position of enemyradar to the radar background... Which is something like this:
getclone(sprintf("enemyradar.%i", cloneindex))->x = radarbckg.x + (enemy.x - region.x)/ratio;
Or something like that... Same should be done with the y coordinate... Collision Finish should make the enemyradar.transp = 1; again
I think that's about it, correct me if the code isn't quite good! The ratio of the actors' sizes is for you to calculate ahead of time. Hope this helped! :wink:
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score

Re: Radar

Postby destinydesignlabs » Thu Apr 22, 2010 7:22 pm

Thanks I will give it a shot when I get home. Ill let you know if it works right.
destinydesignlabs
 
Posts: 10
Joined: Mon Jan 04, 2010 5:24 pm
Score: 0 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron