From Test-Scratch-Wiki

A tycoon project is a game in which you run and operate a business, with the destination of earning as much money as possible. Tycoon projects usually takes experienced programming to create, as well as detailed costumes. Typically, in a tycoon project the user begins with an open area and must construct his/her business in that area. The projects include guests at your business, a money variable, attractions, and varieties of tools for creating a great business.

Creation

Attractions

For a tycoon, many sprites will be needed the represent the different sceneries, shops, and attractions. These may also include multiple costumes to serve as an animation for the attraction. Most attractions use cloning in order to create multiple of them instead of duplicate sprites as in Scratch 1.4. In a tycoon game, on the edge of the screen is generally the toolbar. To create an attraction when it is selected in the toolbar, you can use the following script, the first of which goes into the tool and the second into the attraction:

when I am clicked
create clone of [attraction v]
when I start as a clone
wait until <not <mouse down>>
repeat until <mouse down>
go to [mouse-pointer v]

That basic script is used solely for placing the attraction after its tool is selected. Scripts can be added to the clone in order to generate its properties, such as how much money it gives to the bank and when.

Guests

Guests to the business should also be used as clones. There are some difficulties using cloning instead of sprites for guests, though, since a clone cannot respond to a broadcast. However, guests are usually in great numbers in tycoons, possibly reaching the hundreds, and using separate sprites would greatly increase the project's file space.

Note Note: many guests running at once can cause lag; the computer's processor and RAM have affect on this

To make guests visit different attractions, it is best to have all the attraction clones stored in lists with their x and y positions and their popularity. The following guest scripts are used to make a guest decide if it wants to visit an attraction based on its popularity:

define visit [attraction]
set [item# v] to (1)
repeat until <(item (item#) of [attractions v]) = (attraction)> //used for finding the number an attraction is in the list
change [item# v] by (1) 
end
go to x (item (item#) of [x positions v]) y (item (item#) of [y positions v]) //makes the guest go to the ride
change [money v] by (item (item#) of [ride prices v]) //the guest pays

when gf clicked
if <(pick random (1) to (popularity)) = (1)> //the lower '''popularity''' is the more likely a guest will be cloned
create clone of [myself v]

when I start as a clone
forever
if <(pick random (1) to (100)) = (1)> //this decides if the guest wants to visit anything
set [possible attraction v] to (pick random (1) to (length of [attractions v]))
if <(pick random (1) to (100)) < (item (possible attraction) of [popularity v]> //the higher the attraction's popularity, the more likely this will occur
visit (possible attraction)
end
end
if <(pick random (1) to (1500)) = (1)> //makes the guest leave the park
delete this clone

Using clones tends to make the scripting complicated since clones' x and y positions cannot be determined without lists. How this script works is first off, when the flag is clicked, the project begins randomly generating clones based on the businesses popularity. If the variable "popularity" is higher, it actually means that the business's true popularity is lower, because if "popularity" is higher there is a less likely chance of a "1" being picked and a guest cloned. When a guest is created, the "when I start as a clone" script begins running in that guest. First, the guest decides if it wants to visit an attraction. Then, then it decides what attraction it wants to visit based on its popularity. If it visits, it performs the custom block "visit [attraction]". When the "visit" block runs, it first scans the list of attractions for the specified attraction, in this case the hot dog stand. When it finally finds it, the variable "item#" is the same as the item number of the hot dog stand in the list. Then, in other lists in the same item slot are the x and y positions of the stand, its popularity, price, and more. Since the variable "item#" corresponds to the attraction's items in all these lists, the script can detect the values of the stand's properties. Therefore, the guest goes to the attraction and pays, earning you money.

Objectives

Many tycoon projects have objectives or goals that must be reached. They can bring a challenge into the project and some difficulty instead of free-style. The majority of the time, these objectives have to do with money and typically have a deadline or way to fail the objective. For example, an objective in a project might be to obtain 1,000 money, but it has to be done within a few weeks (project time, not real time). For obtaining money of a certain amount, a similar script as the following can be used.

when gf clicked
wait until <<(money) > [999]> or <(time) = (21)>> //the "21" represents 21 days, or three weeks
if <(money) > [999]> //if the set goal for earned money is achieved
broadcast [show completion message v] //an example of showing a message on the screen notifying one's completion 
else
broadcast [show failure message v] and wait//an example to show one has failed
stop [all v]  //the game ends

Examples

External Links

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