This project is really two things: The background and the computer screen. Since the background takes up the most space, let’s do it first.
The background is all in one object. It has two parts: the trails and the computer. Let’s start with the trails.
The first trail is the wall, it covers the whole screen so it has a width of 3000. The second trail is the desk so I have it a width of 400 and a y position of 25 so the computer can be in the middle. The Y parameter in the second set position is self y position.
This comes next. Make sure to set size before sending to back so that the clone has enough toner to go back first. This means that the clone will be in the back but in front of the original object.
This is the when object’s is cloned rule:
Make sure the send to back is the first block for the same reason as putting a block before you send the original object back.
Send it to a position where it covers the computer screen. I do this in two blocks.
Then set it to a square and give it this set width and height block:
Then set the color to whatever you want. This will be the background color of the screen. We aren’t done in this rule yet though. Add these set variable blocks:
This just lets us get the location and size of the screen quickly. If you want more than 5 emails then you will need to change some of the sizes and distances later.
That’s the background done.
Each email will be a separate object and display:
- A subject
- The sender
- The time sent
Because we want multiple emails, we need to use a custom rule. But we need to tell this rule which email this is and also the information in the list. I’ll get back to the second requirement later. The first is solved by giving each email a y value which it uses to position itself.
The future custom rule will work for any value in this variable greater than or equal to 1. A higher value will place it lower on the screen.
Let’s go into the custom rule which will be in every email object.
The conditional in the cloning rule is an and containing these two conditionals:
The second one ensures that the clones are created only after the variables are set by the background object, since email count is the last one set.
This is the when game starts rule:
The wait 13 frames just waits until the variables are set.
After that is a custom block which is also in a when object is cloned rule. This is what most of the custom rule is.
These three blocks in this order are what displays an email.
The set position sets the starting position. Here is the y parameter for it:
The check if else goes through all four clones including the original object. Here is the first layer:
Here’s the rest of the set width and height parameters:
This creates a line to separate this from other emails.
Here is what is inside of the else part:
The rest of the set variable:
This sets a variable to the width of the first clone. The next clone uses this to position itself.
This is the rest of the set position:
(Where it says “elf” x position, it means “self”)
This clone becomes the subject line.
This is inside of the else part.
The rest of the set position:
This positions it so that the middle is just underneath the right edge of the subject line. This clone will become the sender name. This leaves only the time sent, and that is inside of the else part of the block.
The rest of the set position block:
This positions it at the right edge of the email, but not to the right of the line (clone index 1)
Great, the positioning and coloring is done. Here’s one more thing you can add to the custom rule (but isn’t necessary):
The conditionals are the same. The wait gives it time to position itself.
Now the custom block is done, but the subject, sender, and time aren’t set. Before the custom block in each email add a rule like this: