|This article has links to websites or programs not trusted by Scratch or hosted by Wikipedia. Remember to stay safe while using the internet, as we cannot guarantee the safety of other websites.|
|Please expand this article or section. You can help by talk page. (May 2014)if you are an editor. More information might be found in a section of the|
This tutorial shows how to make a simple life simulation in Scratch. A life simulation is a game in which a player either struggles or peacefully attempts to live their life. Examples include The Sims Franchise, Tomodachi Life, and Animal Crossing.
First make a background. This example is a field but it can be anything.
Houses and People
Variables are going to be a big part of the game, the first one that should be made will be called "Money". Next, put the script below in your game, this will set the player's money to zero when they open the game.
when green flag clicked set [Money v] to  when this sprite clicked change [Food v] by (1) change [Money v] by (-10)
The script above is for a shop that the character will get their food from, so make a shop sprite and put it in that.
when this sprite clicked if <(Money) > > then broadcast [bought item1 v] change [Money v] by (-10) else say [Sorry, not enough money!] for (2) secs end
This script (see above) makes it so the character doesn't fall into debt, it isn't complicated so it is the recommended script.
The Item 1 box is a separate sprite (put a picture of food in the white space and figure out a script to make the player get food when clicked). Here are some of the other 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 stores, general stores, depending on the amount of effort available. The player will have to buy food from shops to live in the simulation.
NPCs and Social Actions
When making a life simulator game, NPCs (Non-Player Characters) are an fun aspect. In life simulators, NPCs can be interacted with and talked to. Depending on how they are treated, they will feel different about the player. NPCs are also found in shops. Other NPCs can be family members like children, parents and/or siblings. If NPCs seem too complicated, a alternate way of having a character's social need go up would be to programme the game so whenis pressed (any key will work, but T is for talk so it is easy to remember) the character talks on the telephone and their Social goes up. Both systems could be implanted in the game, for a extra programming challenge.
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 the player needs to manage their living with fixed amount, add a date system and on the month end or start give the player their monthly salary. Different jobs can be added in the simulation.
In life simulators, home is where the character lives. Furniture can be bought for it and it can be decorated with money earned in the game. These can be expanded into making a community like a neighbourhood or even a city. But making huge communities might be a hassle and it is better to pay less attention on communities rather than life related topics. It would be wise to make the house a place to care for basic needs if less time is available to dedicate to this project.
Just like in real life, hunger is very important for a life simulator project. The character's hunger can be relieved by eating the food purchased at the shop. A good way to do this would be to have a similar thing to the telephone but make it so the food also goes down. The scripts to use are:
When flag clicked set [hunger v] to (10) forever wait (20) secs change [hunger v] by(-1) if <(hunger) < > then say [I'm hungry.] for (3) secs end end
The hunger variable will be at 10 meaning the player has eaten. After sometime, they will get hungry once more by using the above script.
|Note:||This part is completely optional.|
when flag clicked set [disease v] to (0) forever wait (20) secs if <(hunger) > > then change [disease v] by (1) end end
Adding disease will make the game more realistic. When the hunger goes under 5, the player will start getting sicker and sicker. But disease doesn't do anything harmful right now, so add health.
The script is here (an extra "health" variable will be required):
when flag clicked set [health v] to (100) forever wait (10) secs if <(disease) > > then change [health v] by (-5) end end
This is an example project, but it's very old and many features could be outdated.