From Test-Scratch-Wiki

(Redirected from Eng:How to Make a Life Simulator)

Document.png Please expand this article or section. You can help by adding more information if you are an editor. More information might be found in a section of the talk page.


This tutorial shows how to make a simple life simulation in Scratch. A life simulation is a game in which one either struggles or peacefully attempts to live his or her life. Examples include Tomodachi Life and Animal Crossing.

Neighborhood background

Let's start by making a backdrop for this life simulator. Make it nice and green!

Backdrop1.png

Houses and People

A life simulator needs houses and people! Make one of each of these, as a sprite. Here's a sample house.
House1.PNG
And do not forget to add Steve, the nice and friendly faceless stickman. You can make your people whatever you want.
Steve.PNG


Variables

When making a life simulator, one should add variables. One of them should be money. Here's some scripts to use:

when green flag clicked
set [Money v] to [0]

when this sprite clicked
broadcast [bought item1 v]
change [Money v] by (-10)

The first script tells the money to set to zero at the start of the game, so someone can start over without re-starting the page. The second script is for a shop, which will be used for buying new houses, stores, etc. But wait! What if someone clicks the item, and has zero money? Here's the solution:

when this sprite clicked
if <(Money) > [9]> then
broadcast [bought item1 v]
change [Money v] by (-10)
else
say [Sorry, not enough money!] for (2) secs
end

Shop

When making a life simulator, you should add a shop so Scratchers can buy new houses and buildings for their town. Here's an example:
ShopExample.PNG

The Item 1 box is a separate sprite. Here are the scripts used:

when green flag clicked
hide

when [s v] key pressed
show

Also, use the last script in Variables above.

Shops can be of different types like grocery story, general store. The player will have to buy food from shops to live in the simulation.

NPCs

When making a life simulator game, NPCs (Non-Player Characters) are an essential aspect. In life simulators, you can interact with NPCs and talk to them. Depending on how you talk to them, they will feel different about you. NPCs are also found in shops. Other NPCs can be family members like children, parents.

Salaries

Many life simulators have salaries so that players can buy different items. A player must first choose a career. Then, the player's character goes to work and returns home with some money. This is how salaries work. If you want the player to manage his living with fixed amount, add a date system and on the month end or start give the player his monthly salary. Add different jobs in the simulation.

Home

In life simulators, home is where your character lives. You can buy furniture for it and decorate it with money earned in the game. You can expand these into making a community like a neighbourhood or even a city. But making huge communities might be a hastle and it is better to pay less attention on communities rather than life related topics.

Disease and Hunger

Just like in real life hunger is very important for a life simulator project. You can decrease your hunger by eating food, and doing actions like running, walking might increase it. Diseases can be added as a random variable to come up each day. It can be minor or major and effect your game.

The scripts we will use are:

When flag clicked
set [hunger v] to (0)
forever 
wait (20) secs
change [hunger v] by(1)
if <(hunger) > [5]>
say [I'm hungry.] for (3) secs
end
end

The hunger variable will be at 0 meaning the player has eaten. After sometime he will get hungry, so we keep track of that by the increasing the hunger variable. When hunger goes over 5 the player will send a message that he is starving.

External Links

Cookies help us deliver our services. By using our services, you agree to our use of cookies.