Best method of interface development?

luxo-JR

Member
maquette-interface-500x500.png
Hello, I am new to developing with Game Maker, I am French. I am attaching an image of the prototype of the interface that I want to set up. There are 5 sensitive 'zones'. The first consists of a series of discs (which will contain an icon); the second now contains (it can evolve) 4 management buttons; the third contains a selection of one color among 6; the fourth contains two textual information; and the last one, number 5, displays the icon chosen in 1. So much for the description. My question is to find the best solution in Game Maker for such an interface. A set of independent sprites that I position to the nearest pixel. How to give a hover effect when I am over a button (action with the mouse). To be honest, I'm working on a Sokaban type game (old game) and the interface I'm showing you consists of a part of the level creator. Thank you for your answers. Best regards.Jean-François
 

NightFrost

Member
Assuming this is the final layout and the interface will not reconfigure itself to alter positions of interface buttons, you can code much of the required coordinate information directly into the interface object (aka, hardcoding the values).

For circular interfaces (1) and (5) you know the center positions and the radius of each circle. This means you can use a point_distance() to measure mouse pointer's distance from each, and if result falls beneath radius of the circle you know you are hovering over that one.

For interfaces (2) and (3) you have a minimum and maximum distance from the center of the ring. If point_distance() from the center to mouse pointer falls between those values, you know the mouse pointer is hovering somewhere over the ring interface. By taking point_direction() from the center of the ring to mouse pointer, you know the angle over the ring, and can compare it to values you have predetermined to figure which button is being hovered. (In your example, angle between 0 and 45 would mean hover on "New" button.)

For interface (4) you would know a corner position and width and height, or two opposing corner positions. This means you can use point_in_rectangle() with mouse position to detect hover.
 

Yal

🐧 *penguin noises*
GMC Elder
For a lot of things you can just use the Mouse Left Pressed event, then make objects for your buttons (Mouse Left Pressed events happen when the object is clicked on). It's really easy to set up.
 

luxo-JR

Member
Thank you for your answers. As my English can be improved, I have a few questions to ask. Think of this interface as a single image or as a collection of images (objects). In the case of an assembly of objects, how can I position them to the nearest pixel in the 'room'? There's also the fact that I want to put a mouse-over effect above each button.
 
Top