Help, tutorials and extensions for Game Maker
This is an example about resource collection for top-down games. In RTS games, there's usually a way to gather resources such as food, wood, gold... This example gives a good clue as to how you can build something like that. The code will require some modifications to make it look more realistic (obstacles, enable to influence the transporter), but this is a good start.
All code is in GML, no D&D actions.
Ratings
Images
| Gathering the first resources |
 |
There are 3 types of visible objects. The blue ball is the transporter. The red balls are the gathering locations and the green balls are the resources. Each items indicates the amount of reources which it contains. |
| Transport to the gathering point |
 |
When the transporter is filled to its maximum, it returns to the closest gathering point. When the goods are loaded into the gathering point, the total amount of goods, shown at the top-left side of the window, also increases. |
| Filling up |
 |
As long as the transporter isn't filled 100%, it keeps moving to the next resource. |
| All gone |
 |
When all resources are gone, the transporter moves to the closest gathering point to load off the last resources. Then it stops and waits for new resources to appear. |
* : The rating makes use of your IP-address to remember your vote. IP addresses may change, but your vote will be kept, even though it may no longer be visible here.