How do I Incorporate Lists into my Scratch Game?
Sebastian Wright
I want to incorporate a list for my tycoon game, but I do not know how. I tried a lot of ways and failed each time. How can I incorporate a list into my scratch.mit.edu cash tycoon game? I am thinking of having an investment feature but I do not know how to use a list for something like that. I attached an image of my current code:
2 Answers
have three lists:
- a list of all investment options(names)
- a list of their price incressis(the same order as the first list)
- a list on what investments you have(the names)
repeat every ? seconds:
now loop over the last list and based off of the item number of the first list add $ based off the second one
Here's a simple way to write it (scratchblocks format):
[scratchblocks]
forever
add (foo) to [list1 v]
...
add (foo1) to [list2 v]
...
add (foo2) to [list3 v]
...
end
[\scratchblocks]Here's an image:
The foo, foo1, and foo2 operators here are defined as:
foo | foo1 | foo2 |
|---|---|---|
| Adding the list of all of the investment options that there are in your tycoon game | The list of their increasing prices (which would be in the same order as which foo is defined | The list of the investments that you currently own (doesn't necessarily have to be in the same order as foo/foo1) |
Hope this helps!