I’ve made a number of really nice enhancements to my earlier Radar demo.
The improvements:
- The original demo used collision_line() to detect when the radar sweep collided with the radar blips to refresh them. This meant that the collision detection could skip over smaller objects at great distances from the antenna, since the space between steps is not scanned. The new one uses an approach based on the angle difference between the mappable object and the sweep’s current and previous positions, and is therefore much more accurate.
- The original radar used a classic looking monochrome green radar screen. The new one implements IFF (Identify Friend or Foe) color coding. This system is flexible in that it allows you to change the value of the color variables used in the color key, or even a unique color if desired. oMappable child objects must have two instance variables, blip_alpha and blip_color. The demo only uses color for IFF, but for colorblind players it would be helpful to modify the routine to use shape as well as color to identify the blips.
- I’m particularly proud of how understandable and well-commented the code is, so if you’re a developer and want to modify it for your own needs, it should be quite easy to do so.
I still can’t get it to run in HTML5 builds, so a screen shot will have to do.
Download radar_example.gmz
I like the effect! I look forward to seeing how you solve the HTML5 issue.
Jason Lee Elliott
I think my only option for HTML5 is to draw the radar directly to the canvas instead of using surfaces, which is bound to limit performance. But I was under the impression that surfaces were supported in the GM:S HTML5 platform.
chris_sanyk
Really cool :)
True Valhalla
cool! but if you change room it freezes
Fra
When you change rooms, are you destroying the radar object? If you don’t, the surface it uses remains in memory, which could cause a problem. If that’s not it, I’ll have to look at the code and see what’s going on…
Chris Sanyk