![]() ![]() This is also where our second variable we set up comes into play. With the button pushes processed, we can move onto the next part in the loop, where the picture is changed. We could nest these conditional branches into the button pressing ones, but sometimes it’s easier to read the event when it’s more separated. So if by pushing ‘left’ the variable becomes 0, one of the branches will set it back to 1, and the same thing happens for the last page of the book. Now, there’s an issue if we let the variable increase or decrease freely: what happens if we go beyond the number of pages? The pages wouldn’t display properly! So to combat that issue, let’s add two conditional branches that will reset our variable to an actual page number. Since we don’t want the player to be stuck reading the book forever, we’ll also include a conditional branch to see if ‘cancel’ is being triggered and if so, then the loop is broken. So pushing the left arrow key will decrease the variable by 1 and pushing right increases it by 1. To help keep track of things, let’s make sure our variable amount matches the page number it should turn to, so when the variable equals 1 we’re on page 1 and if the variable is 3 then it’s page 3. ![]() Two conditional branches check if the left or right buttons are being pushed, with our first variable being changed if one of the buttons is being pushed (we could set the branches to ‘is being triggered’ if we don’t want the player to be able to flip through the whole book without lifting their finger). The next part of the event is all inside the loop, so it will repeat until the player wants it to stop. A sound effect and a short wait to make sure everything’s ready before the loop begins and our setup is complete. ![]() We could include the instructions on the book’s page itself, but in this case I’m using the instructions for multiple events so it’s easiest to have them separate. Again we’ll use the show picture command to display our page, but this time we’ll also include another picture that explains the controls to the player so that they aren’t confused. We’ll be using variables to keep track of which page our player should be on, so let’s set two variables to 1 for the book’s first page. Luckily we’ve covered something similar in a previous tutorial (Eventing a Push/Pull System), so we can use our knowledge of loops and conditional branches from that to make our book’s event.įirst thing our even needs is the variable and picture setup. To let our players change the book’s page when they want, we’ll need to check when the left and right arrow keys are being pressed. This setup works fine for books, but what if we wanted to let our players flip the pages themselves and go back a page if they felt like it? Then we’ll need to approach the eventing from a different direction. So we want to take that extra second while eventing to make sure we remove the picture once the book is done being read.Īnd with the picture removed, our picture book event is finished! Now our players can flip through the book as quickly or as slowly as they wish. If we forget to do that then the player will be stuck with the page’s image plastered over their view, making it very hard to actually play the game. When we’ve reached the last picture and want to close the book, all we need to do is erase the picture. With those two commands ready and working, we can just copy and paste them and change the show picture’s image until we’ve shown each page image. It’ll simply be an empty message box set to have a transparent background, so that the book’s page will stay on the screen until the player clicks to change the page. But before we copy and paste our command for each page of our book, we might as well make the text command so we can copy that as well. Once we’ve decided on the placement of our picture, the only thing that will change in our event’s other show picture commands is the image we’re calling. So since this example project’s screen width is 1104 and screen height is 624, our X is 552 and Y is 312. Picking the position for our pictures depends on our game’s screen size, but if we want it centered on the screen we just need to pick ‘Center’ for the pictures origin and input half our screen’s width and height values into the X and Y section of direction destination to have it appear in the middle of the screen. We’ll only need three event commands to really make this work: Show Picture, Show Text, and Erase Picture. Now that our three pages are in the right place, we can start working on our event.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |