Life Simulator Tutorial: различия между версиями

Материал из Поле цифровой дидактики
 
(не показана 1 промежуточная версия этого же участника)
Строка 39: Строка 39:


This is carrying on from the Variable section, with extra help on making a shop. Here's an example of a shop sprite:<br />
This is carrying on from the Variable section, with extra help on making a shop. Here's an example of a shop sprite:<br />
[[File:ShopExample.PNG]]


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:
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:
Строка 97: Строка 96:
end
end
end
end
 
</scratchblocks>


[[Category:Scripting Tutorials]]
[[Category:Scripting Tutorials]]

Текущая версия на 19:46, 29 октября 2022

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.

Neighborhood background

First make a background. This example is a field but it can be anything.


Houses and People

Now make a house and a person as two separate sprites, examples are below.
>


Variables

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 [0]

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) > [9]> 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.

Shops

This is carrying on from the Variable section, with extra help on making a shop. Here's an example of a shop sprite:

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 when Шаблон:Kp is 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.

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 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.

Home

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.

Hunger

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) < [5]> 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.

Disease

when flag clicked
set [disease v] to (0)
forever
wait (20) secs
if <(hunger) > [15]> then
change [disease v] by (1)
end
end