Each part of the game loop is a different game mechanic, or action, players can do. This game loop has four game mechanics:
Explore the game to find items.
Harvest items. Players can only hold so many at a time.
Sell items for gold.
Buy bag upgrades to holds more items at a time.
Before starting to build, plan out your game. On the Game Vision handout write:
A description of the setting and what players will be collecting.
Examples:
A fantasy world where cupcakes are as valuable as gold.
A suburban town where you need to collect lost pets.
A future where the most valuable object is a potato.
What the player will harvest.
Examples:
Cupcakes
Lost pets
Magic potatoes
The tool players use to collect that item.
Examples:
Spoon to collect cupcakes.
Net to collect lost pets.
A bucket for potatoes.
What players will buy to hold more items.
Examples:
Cupcake box
Backpack
Create a drawing of the starting area,
Mark down:
Where players start the game.
Placement of the harvestable items.
Where players will sell items.
Where players will buy upgrades.
The name of the game.
Players will be able to see important stats like how much gold they have, the number of items in their bag, and the max number of items they can hold by looking at a leaderboard.
-- Creates a leaderboard that shows player variables
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 0
gold.Parent = leaderstats
local items= Instance.new("IntValue")
items.Name = "Items"
items.Value = 0
items.Parent = leaderstats
local spaces = Instance.new("IntValue")
spaces.Name = "Spaces"
spaces.Value = 2
spaces.Parent = leaderstats
end
-- Run onPlayerJoin when the PlayerAdded event fires
game.Players.PlayerAdded:Connect(onPlayerJoin)