Its all quite exciting..

Top down view

Cant wait to see this when its finished
Its all quite exciting..

Top down view

Cant wait to see this when its finished

The start of the Far Trader mkII ship
I noticed someone had arrived at this site by searching for ’Game Maker radar code’. The radar system I am using in this game might not be what everyone wants, but here it is anyway.
The premise goes something like this:
1. The player object in Far Trader creates a background image that is attached to the player object itself which gives an illusion of a rad projection.
2. Each AI ship instance spawns a radar contact object in its Create Event with the x and y value of the player. This will make a radar contact sprite for each and every spaceship object in the room appear at the players location.

Example of radar system
The code looks like:
Each AI ship instance has in its Create Event
scannerRange=2000; // distance in pixels that objects can be detected
radarContact=instance_create(obj_player.x,obj_player.y,obj_ship_contact);
Then in the AI ship instances’s End Step Event add:
dist = point_distance(x,y,obj_player.x,obj_player.y);
if(dist > scannerRange) {
// hide the sprite
radarContact.image_alpha = 0.0;
} else {
// set sprite alpha as a % of dist from scannerRange
alpha = 100 - ((dist / scannerRange) * 100) ;
radarContact.image_alpha=alpha / 100 ;
}
if(dist < scannerRange) {
if(dist < 390) {
radarBlip=dist;
} else {
radarBlip=390;
}
pDirection=point_direction(x,y,obj_player.x,obj_player.y);
radarContact.x = obj_player.x - lengthdir_x(radarBlip , pDirection);
radarContact.y = obj_player.y - lengthdir_y(radarBlip , pDirection);
}
The above code will pull the radar contact instance away from the player object back to its creator instance, up to a maximum of 390 pixels. The 390 pixel limit is to match the background image attached to the player object, it can be any distance you desire, as long as its visible on the screen! All radar contacts that are greater than scannerRange pixels away have there alpha set to 0.0, which means they are not visible. Once the contact is in scannerRange, the code will set its alpha value to a % of the distance, to give an impression of range, the further away the contact, the more transparent the contact object.
The above is just an example of how I implemented the radar, code. In my game I actually have the code in a script, so that its easy to apply do a number of different object types. I hope someone finds it of use.
This week has been all about getting docking working. As trading will be the focus of the game, a system for docking at places to trade is pretty much essential. Along side the docking process comes the HUD. For now, the HUD shows some basic information such as ship hull damage, fuel level, throttle indicator, speed, grid reference etc. I have also created a radar system that centres around the player object. This radar gives a nice accurate system for showing where you are in relation to other objects in the room (hat tip to 3030 Deathwar for that idea).
Additionally, I have created a test system for changing the players ship. Object inheritance and changing is possible in Game Maker, but not something that I have found easy (until I finally started to read the GM Manual!), so now you can switch between 2 different ships that have different stats on the fly.
Docking has been a complicated affair as im still learning GML, but It has forced me to restructure a lot of the code in the process, producing a more organised application structure.
Wont say any more at the moment, but heres some screen grabs:

the HUD display with docking ring active

More ship sprites