GML Visual Programming problem I don't know where to start

J

JustKay

Guest
Okay so I was wondering if there is any good starting point for wanting to do the following in GameMaker Studio, or places I can reference for this:

  1. Have players drag and drop instructions into a line a player character then executes.
  2. Roaming enemies with a cone of vision for spotting the player character.
 

sp202

Member
For the first one, you'd look into ds_lists combined with scripts. The scripts would contain the instructions, you'd create proxy objects which you can drag and drop onto a portion of the screen where the script it's representing will be added to a ds_list. The player will read one instruction off the list at a time and delete it from the list once it's been executed.

The second is a lot simpler, but I'd need a bit more detail, is there a range limit on the vision cone?
 
J

JustKay

Guest
For the first one, you'd look into ds_lists combined with scripts. The scripts would contain the instructions, you'd create proxy objects which you can drag and drop onto a portion of the screen where the script it's representing will be added to a ds_list. The player will read one instruction off the list at a time and delete it from the list once it's been executed.

The second is a lot simpler, but I'd need a bit more detail, is there a range limit on the vision cone?
Yes! There is a limit on the range of the vision cone. I guess the easiest way to describe it would be like the cones of effect that alot of RP tabletop games have.
 

sp202

Member
point_direction can be used to find the direction between the enemy and player, so you can define a range of angles at which the player will be detected. Then you can use point_distance to limit its range.
 
J

JustKay

Guest
point_direction can be used to find the direction between the enemy and player, so you can define a range of angles at which the player will be detected. Then you can use point_distance to limit its range.
Do you have any good recommendations for tutorials using these?
 
F

frumple

Guest
The manual is good, but tutorials that are part of GM are very helpfull, as are example games. For anyone starting at the beginning, those would be the best ways to learn by doing.
 

sp202

Member
While I agree that tutorials can be extremely helpful, functions like these are ubiquitous and intuitive functions that would benefit more from explanation and then doing your own experimentation. Might be just my preference, but I'd rather not spend time on a tutorial, especially video tutorials when I can hop into GM and get hands on immediately.

@JustKay For the cone of vision, think of it mathematically; a cone of vision is essentially a sector of a circle. The definition of a circle is that it is the same length in every 2-dimensional direction, this is what point_distance can be used for. If the player is a certain distance or less from the enemy, they are within a circular range (but not necessarily within the cone). For that you'd need to define the bounds as angles, which is where point_direction comes in. If the angle between the player and the enemy, is within a certain number of degrees on either side of the direction the enemy is facing, then the player is in sight.
 
Top