Experiment 7: Arrays

Size: px
Start display at page:

Download "Experiment 7: Arrays"

Transcription

1 Experiment 7: Arrays Introduction Until now, we ve been content with storing one value in one variable. What if you want to store lots of values? That s where arrays become useful. This experiment is going to examine a couple ways in which you can make and use arrays when programming a small game. Go ahead and make a new copy of the Perlenspiel Template folder in your PGF Projects folder, and name it Experiment 7 - Arrays. Open the game.js file and get ready to program! Setup The game we are making will involve a player pawn that moves up the screen past moving enemies in order to collect goals. After a goal is collected, the player starts at the bottom of the screen again. Hitting an enemy resets the player to the bottom of the screen. Let s start by defining some global variables that we are going to use in this game. We re going to use objects similar to how we used them in lesson 6. var GAME = w : 8, h : 12, // Speed of updates clock : 15, gridbackgroundcolor : 0x336699, running : true, ticking : false, ; The GAME object has properties for the width and height of the grid, the clock speed (which is used for updating the enemy positions), the background color of the page, and a boolean to remember if the game should be updating or not. This type of object initialization is called an object literal. The general syntax for this is: var ObjectName = property1 : "val1", property2 : "val2", property3 : "val3"; To make it easier to read, you can put each property/value pair on its own line: var ObjectName = property1 : "val1", property2 : "val2", property3 : "val3" ; PGF: Experiment 7 Arrays Pg. 1

2 Note that you won t need this specific object in your program it is merely an example of the syntax. Put it in your notes! The properties are like variable names, and the values are the value that each property is initialized to in the object. Each pair needs a colon between them, though the spaces are optional. The list of pairs itself is commaseparated. The last pair doesn t need a comma after it. Note that the above example won t actually run you would need to define the values, or use numbers and strings in their place. Here s another object that we will need so that we can track the player s location and stats: // Player tracking var PLAYER = numprizesleft : 0, starty : GAME.h-2, // These are given values in ResetGame x : 0, y : 0, The PLAYER properties should be pretty self-explanatory. At any rate, we ll see how they are used later. PS.init PS.init needs some code to set up the grid how we want it: // PS.init( system, options ) // Initializes the game PS.init = function (system, options) "use strict"; PS.gridSize(GAME.w, GAME.h); // replace with your own x/y values // Add any other initialization code you need here PS.fade(PS.ALL, PS.ALL, 0); PS.statusFade(0); ; // Load audio PS.audioLoad("fx_bucket"); PS.audioLoad("fx_bloop"); PS.audioLoad("fx_ding"); This is pretty straight-forward. Set the grid size, turn off the annoying bead and status flashing, and load some audio for later. PGF: Experiment 7 Arrays Pg. 2

3 Drawing the Grid For this game to look polished, we ll need to draw some stuff in the grid. First, a function that resets a bead to its empty state, including a neutral gray color: // Erases everything in a bead function EraseBead(x, y) PS.data(x, y, 0); PS.color(x, y, 0x858585); PS.glyph(x, y, 0); PS.border(x, y, 0); Note how it uses x and y parameters so that the caller can use it at any location. This makes the function useful for more than one thing. We ll also need a function to draw the player bead. This code goes in the functions area as well. // Draws the player pawn function DrawPawn(x, y) PS.data(x, y, "pawn"); PS.glyphColor(x, y, 0xFFFFFF); PS.glyph(x, y, "O"); This will draw a white O in the specified bead. PGF: Experiment 7 Arrays Pg. 3

4 The next function is one that we can call from PS.init to reset the game state. // Sets up the initial player, game, and board state function ResetGame() GAME.running = true; PLAYER.x = 4; PLAYER.y = PLAYER.startY; PLAYER.numGoalsLeft = 0; // Draw the board DrawPlayingField(); // Draw the player at their initial position DrawPawn(PLAYER.x, PLAYER.y); // Start the timer function if (GAME.ticking == false) GAME.ticking = true; PS.timerStart(GAME.clock, GameUpdate); First, it sets the GAME.running variable to true. This doesn t do anything yet, but it will be important later. It s going to be used to keep track of whether the game is being played or whether the game is paused due to the player having completed it. Right now, know that setting it to true means that the player will be able to play the game. Next, it sets the PLAYER object s properties to some starting values. PLAYER.numGoalsLeft is the number of goals the player has to collect. It will remain at zero until the goals are actually placed in the grid, which will be later in this document. Then, it calls the function DrawPlayingField. That function is shown below (make sure you place this in the functions area as well): function DrawPlayingField() // Set background color of the page PS.gridColor(GAME.gridBackgroundColor); // Erase the board EraseBead(PS.ALL, PS.ALL); This function sets the background color of the page and then erases all beads in the grid. Note that PS.ALL can be used even in custom functions but only if those parameters are used in places where PS.ALL makes sense. PGF: Experiment 7 Arrays Pg. 4

5 Back to ResetGame: There is some code to draw the pawn. This way the pawn is visible right when the game starts, before the player has taken any action. Finally, a new function: PS.timerStart. This function allows you to create timed code that runs even if the player isn t doing anything. The first parameter is the number of 1/60ths of a second between calls of the timer function. The timer function is the second parameter, which is actually a reference to a function. GameUpdate doesn t exist yet, so let s create that: // This function is called by a timer function GameUpdate() It ll be empty for now, but that s fine. To set this all in motion, add a function call to ResetGame() at the end of PS.init. Now when you run the program, you should see a grey area with the player object near the middle bottom. The page should have a blue background. No interaction will be working yet, though! Player Movement The player will need to be able to move in this game, just like it did in lesson 6. To do this, let s write a function that handles just the player movement. function MovePlayer(key) // Remember the old player location var oldx = PLAYER.x; var oldy = PLAYER.y; // Erase the player at their previous position EraseBead(PLAYER.x, PLAYER.y); if( key == PS.KEY_ARROW_RIGHT && (PLAYER.x < (GAME.w - 1)) ) PLAYER.x += 1; else if( key == PS.KEY_ARROW_LEFT && (PLAYER.x > 0) ) PLAYER.x -= 1; else if( key == PS.KEY_ARROW_UP && (PLAYER.y > 0) ) PLAYER.y -= 1; else if( key == PS.KEY_ARROW_DOWN && (PLAYER.y < (GAME.h - 1)) ) PLAYER.y += 1; // Draw the player at their location DrawPawn(PLAYER.x, PLAYER.y); PGF: Experiment 7 Arrays Pg. 5

6 This is mostly the same as the standard code from lesson 6. To kick it off, add a call to MovePlayer() in PS.keyDown. // PS.keyDown ( key, shift, ctrl, options ) // Called when a key on the keyboard is pressed PS.keyDown = function (key, shift, ctrl, options) "use strict"; // Uncomment the following line to inspect parameters //PS.debug( "PS.keyDown(): key = " + key + ", shift = " + shift + ", ctrl = " + ctrl + "\n" ); ; // Add code here for when a key is pressed MovePlayer(key); That s a lot of setup, but the player should be able to finally move. Test it now and make sure that the player can t escape from the playing area. Walls Let s add some wall beads around the border of the playing area. Here is a drawing function for them: // Impassable grey walls function DrawWall(x, y) PS.data(x, y, "wall"); PS.color(x, y, 0x454545); Feel free to make the walls fancier than this. Use this function to draw walls along the four edges of the grid. This code can go into DrawPlayingField: // Draw four walls DrawWall(0, PS.ALL); DrawWall(GAME.w-1, PS.ALL); DrawWall(PS.ALL, GAME.h-1); DrawWall(PS.ALL, 0); This places the walls, but we need to also keep the player from passing through them. You can again use code from lesson 6. PGF: Experiment 7 Arrays Pg. 6

7 This code will be a modification to MovePlayer - make sure it s placed after the if/else-if block, but before the DrawPawn call: // Get the bead data from the player's new location var dataatplayer = PS.data(PLAYER.x, PLAYER.y); // If it was a wall, print something and reset the player position if( dataatplayer == "wall" ) // Rewind so the player doesn't go through the wall PLAYER.x = oldx; PLAYER.y = oldy; // Draw the player at their location DrawPawn(PLAYER.x, PLAYER.y); Test it out! The player should no longer be able to walk into the wall beads. One Hundred Enemies If we were making a game with a single enemy, planning out the code would be rather simple. You could create a global object named ENEMY, give it some coordinates, and put some logic in GameUpdate to make it move around depending on what you want it to do and where the player is. Let s say your project lead stops by and asks you to add a second enemy, since single-enemy games are out of style right now, and having more moving enemies will make the game more dynamic. We got this, of course simply make a copy of ENEMY, naming the first one ENEMY0 and the second ENEMY1. Then, you can make a copy of the code in GameUpdate so that both enemies have the same movement and behaviors. After a couple hours, the lead stops by again with great news they landed a contract! However, the contract is for a game with one hundred enemies. While you could technically make 100 objects and 100 copies of the ENEMY movement code, this is clearly not a good way to go about things. It would be a nightmare to debug code that has an ENEMY0, ENEMY1, ENEMY2, etc., any of which might have a typo or bug in it. What s the correct way to solve this programming nightmare? How do you keep track of a hundred, a thousand, a million things that are all the same type? Luckily, JavaScript, along with most programming languages, has a useful type of variable called an Array. An array is a container that can hold variables inside it in a list or table format. While you can store many different types of variables in one array, they are most useful when storing a list of variables which are all the same type or have something to do with each other. A great example would be to store our list of enemies instead of making 100 enemy variables, you make one ENEMIES array and fill it with as many enemies as you d like. Then, you can use for-loops to process, update, and draw all of the enemies. Adding more enemies or removing enemies won t affect the updating code, since you can set up the for-loop to operate the same regardless of how many variables are inside the array. PGF: Experiment 7 Arrays Pg. 7

8 An Array of Enemies Arrays are declared similar to any other variable, with the var keyword. To initialize it to a value, however, you need to do something new. Specifically, we re going to use the new keyword. Place this code right after the GAME and PLAYER objects: // Enemy tracking var monx = new Array(); var mony = new Array(); var mondir = new Array(); These three variables are going to be used to keep track of every monster/enemy in the game. Since each monster will have an x location, a y location, and a direction, we need one array for each of those things. These arrays are currently empty, but that s because we haven t made any monsters. We also don t have a function for drawing monsters! Let s write one: // Draw a monster function DrawMonster(x, y) PS.data(x, y, "monster"); PS.glyphColor(x, y, PS.COLOR_BLACK); PS.glyph(x, y, "#"); This will draw a black # in the specified bead, representing our enemy. There are two new ideas that we will need to implement in order to get monsters showing up. First, we need to put values into the enemy tracking arrays (monx, mony, mondir) so that each monster is tracked. Then, we need to loop over those arrays and display the monsters with the DrawMonster function. // Spawn a monster by adding it to the arrays and then drawing it function SpawnMonster(x, y, dir) monx.push(x); mony.push(y); mondir.push(dir); DrawMonster(x, y); What is.push? It s a method, which is a type of function that is attached to an object. In this case, all Array variables are also objects ones that have the push function, along with several other useful methods. It takes the parameter passed into it and appends it to the end of the array, increasing the array s length by one in the process. If you push a value into an array, and then look in the array, you ll see the new value at the end. In order to see this happen, it s useful to use the console to print out the contents of the arrays while working on them. Start up the game and open the debug console. PGF: Experiment 7 Arrays Pg. 8

9 Remember, you can open the console by right-clicking in the playing area, then selecting Inspect Element, and then clicking on the Console tab. Once there, try typing: > monx The console will print out: [] This is the friendly version of what an empty array looks like. The square brackets are like a box, and right now nothing is in them. If you type mony or mondir to view them, they will also be empty. Try typing this, next: > SpawnMonster(4, 2, 1); This will print out a monster on the grid at location 4,2, but it will also add elements to all three arrays. PGF: Experiment 7 Arrays Pg. 9

10 The array monx now has the number 4 in it, mony has the number 2, and mondir has the number 1. You can see them printed out in the following image: Let s spawn some more monsters, then look at monx and mony: > SpawnMonster(4, 3, 1); > SpawnMonster(5, 2, 1); > SpawnMonster(6, 4, -1); > SpawnMonster(1, 4, -1); Including the first SpawnMonster call above, there are now five Monsters on the grid. PGF: Experiment 7 Arrays Pg. 10

11 Next, let s look at the arrays: > monx [4, 4, 5, 6, 1] > mony [2, 3, 2, 4, 4] > mondir [1, 1, 1, -1, -1] As you can see, each array now has 5 elements, listed in the same order that the monsters were spawned. This code looks to be ready for the level setup, so write this into the DrawPlayingField function so that the monsters spawn when the game starts: // Spawn new enemies SpawnMonster(1, 2, 1); SpawnMonster(3, 3, -1); SpawnMonster(4, 5, 1); SpawnMonster(6, 7, -1); SpawnMonster(4, 9, -1); You should place this code at the end of DrawPlayingField. Your game should now look like the image on the right. If not, go back and make sure that your code matches the examples. PGF: Experiment 7 Arrays Pg. 11

12 Monster Mover Now that we have monsters stored in their arrays, we can write some code to move them around. There is no magic here moving a monster simply means to adjust its coordinate, while also erasing it from the old location, and drawing it in the new location. Since we want this to happen on its own at regular intervals, we will be using the timer functions in Perlenspiel. The timer function will call an Update function which will loop through the monsters and update each one. Here is the function, complete with a debug printout for the monster locations: // Moves the monsters around function UpdateMonsters() // Erase all monsters for( var i = 0; i < monx.length; i++ ) EraseBead( monx[i], mony[i] ); // TODO: Move all monsters // Clear the debug window so that it doesn't fill up PS.debugClear(); // Draw all monsters for( var i = 0; i < monx.length; i++ ) PS.debug("Monster " + i + ": " + monx[i] + ", " + mony[i] + "\n"); DrawMonster( monx[i], mony[i] ); This code has some new syntax square brackets. This is how you can access a specific element from inside of an array. The number or value inside the square brackets indicates the index that you are accessing. Arrays always start at index 0, so our arrays with 5 items have the possible indexes of 0, 1, 2, 3, and 4. Accessing an array beyond its largest valid index can cause some odd behavior in your program, so be wary of it! The special property.length can always tell you the exact number of elements in an array. This is incredibly valuable when using them in for-loops like this where you want to look at every individual element of the arrays. The for-loops used in this function are using a technique called looping through an array. The variable i is both the looping variable and the index of the array. By writing monx[i] and mony[i], the item at index i of each array is accessed and sent to the EraseBead and DrawMonster functions. Array indexes always start at zero, which is why the for-loops start at zero. PGF: Experiment 7 Arrays Pg. 12

13 Here is the function being called in GameUpdate: // This function is called by a timer function GameUpdate() UpdateMonsters(); When you run this, you ll see the debug printout for the different monsters. It will print out again every quarter second (our clock speed is 15/60), but the code also erases the debug log before each printout, so you will only ever see the most recent coordinates. Even though it doesn t appear to do anything yet, UpdateMonsters() is laid out so that we can make changes to each monster s location quite easily. It is divided up into three sections one that erases all of the monsters, one that will eventually move the monsters, and one that draws all of the monsters. Since the updating happens after the erase and before the draw, it will give the illusion of movement, just like the keyboard movement examples from lesson 6. Let s get some movement happening. Write another for-loop in the UpdateMonsters function, this time between the erase and draw loops: // Move all monsters for( var i = 0; i < monx.length; i++ ) // This is where the motion happens! Inside the body of the loop, we have access to the following useful information: The index of the current monster, i The x-location of that monster, monx[i] The y-location of that monster, mony[i] The direction that monster is going, mondir[i] What we can do right now is look at the direction of the monster and adjust its x-location appropriately. Since I chose the values for mondir carefully, we can simply add its values to that of monx: // Move all monsters for( var i = 0; i < monx.length; i++ ) // Move in the direction specified monx[i] += mondir[i]; If you run this, you ll notice the monsters move towards the edges of the grid and escape. Then, there will be a barrage of uh ohs. Go ahead and close the tab now, I won t mind. PGF: Experiment 7 Arrays Pg. 13

14 Let s write some code to keep the monsters inside the visible area: // Move all monsters for( var i = 0; i < monx.length; i++ ) // Move in the direction specified monx[i] += mondir[i]; var dataatmonster = PS.data( monx[i], mony[i] ); // Monster hit a wall if( dataatmonster == "wall" ) // Backtrack one space monx[i] -= mondir[i]; // Flip the direction mondir[i] *= -1; This code will examine the data inside the bead that the monster is going towards, and if it s a wall, it will do two things: 1. Move backwards one space with respect to the direction it was moving. This way it won t end up in the wall. 2. Flip the direction (if it was 1 it will be -1, if it was -1 it will be 1). This way it will be moving away from the wall during the next tick. This is exciting stuff! Test the program and play around with it for a little bit, see what else we need to make this a game. We ll get to that shortly! While you re thinking about it, this is a good time to revisit chapter 4 of Eloquent JavaScript, or chapter 11 of JavaScript: A Beginner s Guide, whichever book you are using. See if you can understand Arrays a bit better now! PGF: Experiment 7 Arrays Pg. 14

15 Just to make sure you re caught up, here s the entire UpdateMonsters function: // Moves the monsters around function UpdateMonsters() // Erase all monsters for( var i = 0; i < monx.length; i++ ) EraseBead( monx[i], mony[i] ); // Move all monsters for( var i = 0; i < monx.length; i++ ) // Move in the direction specified monx[i] += mondir[i]; var dataatmonster = PS.data( monx[i], mony[i] ); // Monster hit a wall if( dataatmonster == "wall" ) // Backtrack one space monx[i] -= mondir[i]; // Flip the direction mondir[i] *= -1; // Clear the debug window so that it doesn't fill up PS.debugClear(); // Draw all monsters for( var i = 0; i < monx.length; i++ ) PS.debug("Monster " + i + ": " + monx[i] + ", " + mony[i] + "\n"); DrawMonster( monx[i], mony[i] ); PGF: Experiment 7 Arrays Pg. 15

16 Here s how it looks when you run the game: The monsters will move back and forth, displaying their locations in the debug box as they update. PGF: Experiment 7 Arrays Pg. 16

17 Collisions Now that we have moving monsters and a moving player, we need to get them to interact with each other. This will work similar to how the player interactions worked in lesson 6, although now we have multiple moving entities that all care about where they are going and what they are bumping into. We ll start by making it so that monsters act similar to walls when the player bumps into them. This prevents the player from walking right through the monsters. Add this code in MovePlayer after the wall check for the player: // If the player hits a monster... if( dataatplayer == "monster" ) // Rewind so the player doesn't go through monster PLAYER.x = oldx; PLAYER.y = oldy; If you try this out, you ll notice that you can t walk INTO the monsters, but they can still move into you just fine. They also don t hamper the player in any meaningful way, but we ll address that later. To fix the lack of collisions, we can add a check in the monster s movement code to detect when they hit the player. Place this new code in the UpdateMonsters() function after the wall check: // Monster hit the player if( dataatmonster == "pawn" ) // Backtrack one space monx[i] -= mondir[i]; // Flip the direction mondir[i] *= -1; Try it out! The player and monsters should no longer be able to overlap each other in any circumstance. You can even pin monsters against a wall, eternally turning around since something is in the way. Next, we need to make something meaningful happen to the player when they collide with a monster. We ll write this in a new function, named KillPlayer(). // If the player pawn ran into a monster, call this function to reset them function KillPlayer() PS.audioPlay("fx_bucket"); EraseBead(PLAYER.x, PLAYER.y); // Put the player at the beginning PLAYER.y = PLAYER.startY; DrawPawn(PLAYER.x, PLAYER.y); PGF: Experiment 7 Arrays Pg. 17

18 What does this function involve? First, a sound is played this is feedback for the player so that they can tell that their player pawn kicked the bucket. Next, the player s current position is erased. This is the position that the player was in when they ran into the monster. After this, the player s y coordinate is changed so that the player is back on the starting row. Finally, the player pawn is redrawn, so that they appear at their starting location immediately. If you leave this last line off, the player will be invisible until they make a movement. As mentioned in the comment at the header of this function, this function needs to be called wherever the player and monster collide. Let s update the two locations. The first is in MovePlayer, right after the player position is reset: // If the player hits a monster... if( dataatplayer == "monster" ) // Rewind so the player doesn't go through monster PLAYER.x = oldx; PLAYER.y = oldy; KillPlayer(); The second is in UpdateMonsters() after the monster s direction is flipped: // Monster hit the player if( dataatmonster == "pawn" ) // Backtrack one space monx[i] -= mondir[i]; // Flip the direction mondir[i] *= -1; KillPlayer(); If you test it out, you ll find that now it s a pretty big challenge to get to the top of the board without getting hit by one of the monsters. Objectives The next step in this game is to create a goal for the player. We re going to make it work like Frogger, so that the player has to traverse the dangerous area multiple times. In Frogger, there is a collection of goal tiles at the top of the screen. When the player navigates to one, it s collected and the player is placed back at the bottom of the screen for another go-around. This continues until all of the goals have been collected. To implement this in Perlenspiel, we need the following things: A couple goal squares for the player to get to A player stat to keep track of how many goals are left PGF: Experiment 7 Arrays Pg. 18

19 When the player hits a goal square: o Play a sound o Change the goal square to a collected goal square, which the player can t move into o Subtract one from the goals left player stat o Move the player back to the starting row When the player hits a collected goal square: o Treat it like a wall We can start by creating the actual goal squares, as well as their completed counterpart. Like most features of this game, we can define a DrawGoal function and a DrawCompletedGoal function, like this: // Destination goal squares function DrawGoal(x, y) PS.data(x, y, "goal"); PS.glyphColor(x, y, 0x99EE11); PS.glyph(x, y, "$"); This draws a green dollar sign. // A goal square after being picked up function DrawCompletedGoal(x, y) PS.data(x, y, "wall"); // It's a wall so that the player can't go in PS.glyph(x, y, " "); PS.glyphColor(x, y, 0xFFFFFF); This draws a white star. It has the same bead data as a wall, which lets us piggy-back on the player/wall and monster/wall movement code thus preventing them from moving into a collected goal. To make the goals start out on the grid, add some code to DrawPlayingField to place them in the top empty row. Place this code at the end of that function. // Draw the correct number of goals for( var x = 1; x < GAME.w-1; x++ ) DrawGoal(x, 1); PGF: Experiment 7 Arrays Pg. 19

20 If you test your game, the goals show up. Here s how it looks: Right now, the goals don t have any interactions yet. We need to add a condition in MovePlayer that checks to see if the player bumped into a goal. // Player made it to the goal if( dataatplayer == "goal" ) // Collect that square DrawCompletedGoal(PLAYER.x, PLAYER.y); // Put the player at the beginning PLAYER.y = PLAYER.startY; This logic can go after the dataatplayer == "monster" if-statement. It uses most of the same pieces of logic we ve already used. When the player moves into the goal, this means the player is standing on top of the goal (briefly), so we can draw a completed goal there. Then, move the player s y-coordinate back to the starting row. This will cause the player to have to move up through the dangerous middle area a total of six times to collect all of the goals. Is this too many times? Well, you can be the judge of that! However, there currently isn t anything that is keeping track of how many are left on the board. Luckily, we made a player stat called PLAYER.numGoalsLeft which we can use to store how many there are remaining. It s already initialized to zero when the game loads, and we can add to it whenever a goal bead is placed. This code will go into the bottom of the DrawGoal function: // Add one to the number of goals that the player has to collect PLAYER.numGoalsLeft++; PGF: Experiment 7 Arrays Pg. 20

21 Now, whenever you draw a new goal in the level, the number of goals left is incremented. It will automatically keep track! Next, we need remove goals from this number as they are collected. In other words, we will subtract one from, or decrement, PLAYER.numGoalsLeft. We will know if the last one was collected when the number reaches zero. We ll put all of this functionality into a new function named Score, and then invoke it when the player runs into a goal. function Score() // Subtract from the number left PLAYER.numGoalsLeft--; PS.audioPlay("fx_bloop"); if( PLAYER.numGoalsLeft <= 0 ) // The player won! PS.statusText("Congrats! Press R to restart."); PS.gridColor(PS.COLOR_WHITE); PS.audioPlay("fx_ding"); Here s what happens: First, it decrements the number of goals left. A sound plays for feedback. Next, there s a comparison to see if the number of goals left is less than or equal to zero. If it s true, it means that the player has collected all of the goals, and we can display a victory message, set the entire screen to have a white background, and play a ding sound. This Score() function needs to be invoked in MovePlayer, inside of the if-statement for colliding with a goal: // Player made it to the goal if( dataatplayer == "goal" ) // Collect that square DrawCompletedGoal(PLAYER.x, PLAYER.y); Score(); // Put the player at the beginning PLAYER.y = PLAYER.startY; This is enough to be able to test and complete an entire game from beginning to end. The game is inching towards completion! However, the game is still running after collecting the final goal, and there s no way to reset. Let s look at those next! PGF: Experiment 7 Arrays Pg. 21

22 Game State Keeping track of what a game as a whole should be doing is an important facet of game development. In this game we only need two states one for the regular gameplay, and one for the victory condition. This is an additional requirement we can add to our list from above: When the final goal square is collected: o Stop all player inputs o Display a victory screen o Allow the player to reset by pressing R The concept of a game state is different in various game engines. Many have a lot of built-in features that allow you to separate out functionality and levels into discrete packages that run independently from each other, and provide routines that load into any game state that you wish with a single function call. In Perlenspiel, none of this is built-in, but we can write it ourselves, provided we stay organized. Most of the separation between the running and victory states can be handled with simple if-statements that ask whether the game is running or not. Let s rewind a bit and look at our GAME object back in the global variables: /* Game Data */ var GAME = w : 8, h : 12, // Speed of updates clock : 15, gridbackgroundcolor : 0x336699, running : true, ticking : false, ; This underlined variable, GAME.running, may have been created at the beginning of this experiment, but I intended all along for it to be used for this purpose! As you can see, it starts out with the value of true, which we will use to mean that the game should be running when it first loads. This part is already working, of course. The additions we ll need to make will have to do with setting GAME.running to false, and then preventing the game from continuing as long as it remains false. Finally, we ll provide a way for the player to reset the game, by setting GAME.running back to true, placing the player at their start location, and resetting the goals. PGF: Experiment 7 Arrays Pg. 22

23 Where does GAME.running get set to false? Well, we need to do this when the player wins, so it can go into the same if-statement body in the Score() function that displays the Congrats! message. if( PLAYER.numGoalsLeft <= 0 ) // Stop the game GAME.running = false; // The player won! PS.statusText("Congrats! Press R to restart."); PS.gridColor(PS.COLOR_WHITE); PS.audioPlay("fx_ding"); I ve underlined the new code that you need to add. Next, we need to do something with this variable. Right now it turns on and off, but it doesn t actually stop the game from running. First, though, we need to know what it means that the game is running. It means that the player can move around, and that the enemies can move around. Where is this controlled? Looks like it s PS.keyDown and GameUpdate, respectively. We can prevent either action from happening by using simple if-statements. Here s the if-statement you ll write in PS.keyDown: if( GAME.running ) MovePlayer(key); This new if-statement makes sense if you just read it out loud, with some adjustments to make it sound correct, of course. This code says, If the game is running, move the player. Looks good! Before we continue, we can add some code here that resets the game. One important thing here is to make sure that this only happens if the game is NOT running. Sounds like a job for an else! PGF: Experiment 7 Arrays Pg. 23

24 // PS.keyDown ( key, shift, ctrl, options ) // Called when a key on the keyboard is pressed PS.keyDown = function (key, shift, ctrl, options) "use strict"; // Uncomment the following line to inspect parameters //PS.debug( "PS.keyDown(): key = " + key + ", shift = " + shift + ", ctrl = " + ctrl + "\n" ); ; // Add code here for when a key is pressed if( GAME.running ) MovePlayer(key); else // Game not running if( key == 114 ) // The 'r' key to reset ResetGame(); Go ahead and test it! After you win, the controls are disabled, and you can restart by pressing r on the keyboard. The number 114 in the code is the ASCII character code for the lower case r. You can read more about ASCII here: There are a couple problems remaining, though. The enemies keep on going, and they also duplicate themselves when the game restarts. The status text message gets stuck on Congrats!. We have some work left to do! Two of the problems can be fixed in ResetGame(). We need to set the status text to, well, anything at all. I ll use it to write a title for the game. // Set the status text PS.statusText("Get the Cash"); The problem with the duplicating enemies is caused by the arrays not being emptied out before new monsters are pushed in. You can empty an array by assigning it a new Array(), similar to how they were initialized in the first place. // Delete enemies monx = new Array(); mony = new Array(); mondir = new Array(); Put this code anywhere into ResetGame as long as it s before the call to DrawPlayingField, since that s PGF: Experiment 7 Arrays Pg. 24

25 where the monsters are spawned or respawned. It wouldn t work well if you spawned them first and then erased them afterwards. If you test your game now, the major bugs with the reset are all fixed. Next, we can turn off the monster updates if the game isn t running. This is a simple addition to GameUpdate to ensure that they only move while the GAME.running variable is true. // This function is called by a timer function GameUpdate() if( GAME.running ) UpdateMonsters(); Looks almost the same as the change we made to PS.keyDown. The game is pretty much feature-complete, but there are still some more polish items to take care of. First, the pawn should probably just disappear when the game is completed. We can prevent it from drawing during that last move by putting an if-statement around the call to DrawPawn at the end of the MovePlayer function. Like this: // Draw the player at their location if( GAME.running ) DrawPawn(PLAYER.x, PLAYER.y); We ve gotten a lot of mileage out of this one if-statement. It s a useful construct! Take notes about it! Finally, remove the PS.debug calls so that there isn t a clutter below the game. The game is complete! Or is it? PGF: Experiment 7 Arrays Pg. 25

26 Extending the Game Where do we go from here? There are a couple areas in this game that could use some work, if you were to try to make it more of a proper game, you might want to add lives or health, ways to destroy or spawn new enemies, or possibly even have different level layouts in order to provide difficulty progression. Some of these features are fairly straightforward and can be added on top of the existing functionality without modifying anything that s already there. Some, however, like the additional level layouts, may require a significant addition to the architecture of the game. For instance, you will need to store which level the player is on, and have clean transitions between the levels, including intermediary states. Here are some examples: Idea Implementation Lives System Global variable to store the number of lives Function to display the number of lives Subtract a life when the player is killed When the lives reach zero, end the game Reset the lives when the game restarts Difficulty Progression: Levels Global variable to store which level is currently loaded Function to display/load a particular level When a level is completed, advance to the next one When the last level is completed, the game ends Difficulty Progression: Enemies Array of enemy locations to spawn in When a goal is collected, take the first location and spawn an extra enemy there. Then remove this element from the array. When the game is reset, also reset this array Conclusion That ends things for this experiment. As always, feel free to explore and extend this project until you are fully satisfied with what you ve created. Arrays are a crucial data structure in many programming languages. They can allow you to store multitudes of data, which can be added to, deleted, or modified in real-time as someone interacts with your program. What I ve shown you here is only the surface of what you can make using arrays and the PS.startTimer function. Pretty much any serious game effort in Perlenspiel will use both of these parts. Happy experimenting! PGF: Experiment 7 Arrays Pg. 26

2D Platform. Table of Contents

2D Platform. Table of Contents 2D Platform Table of Contents 1. Making the Main Character 2. Making the Main Character Move 3. Making a Platform 4. Making a Room 5. Making the Main Character Jump 6. Making a Chaser 7. Setting Lives

More information

G54GAM Lab Session 1

G54GAM Lab Session 1 G54GAM Lab Session 1 The aim of this session is to introduce the basic functionality of Game Maker and to create a very simple platform game (think Mario / Donkey Kong etc). This document will walk you

More information

C# Tutorial Fighter Jet Shooting Game

C# Tutorial Fighter Jet Shooting Game C# Tutorial Fighter Jet Shooting Game Welcome to this exciting game tutorial. In this tutorial we will be using Microsoft Visual Studio with C# to create a simple fighter jet shooting game. We have the

More information

Game Maker Tutorial Creating Maze Games Written by Mark Overmars

Game Maker Tutorial Creating Maze Games Written by Mark Overmars Game Maker Tutorial Creating Maze Games Written by Mark Overmars Copyright 2007 YoYo Games Ltd Last changed: February 21, 2007 Uses: Game Maker7.0, Lite or Pro Edition, Advanced Mode Level: Beginner Maze

More information

Tutorial: Creating maze games

Tutorial: Creating maze games Tutorial: Creating maze games Copyright 2003, Mark Overmars Last changed: March 22, 2003 (finished) Uses: version 5.0, advanced mode Level: Beginner Even though Game Maker is really simple to use and creating

More information

VACUUM MARAUDERS V1.0

VACUUM MARAUDERS V1.0 VACUUM MARAUDERS V1.0 2008 PAUL KNICKERBOCKER FOR LANE COMMUNITY COLLEGE In this game we will learn the basics of the Game Maker Interface and implement a very basic action game similar to Space Invaders.

More information

Experiment 02 Interaction Objects

Experiment 02 Interaction Objects Experiment 02 Interaction Objects Table of Contents Introduction...1 Prerequisites...1 Setup...1 Player Stats...2 Enemy Entities...4 Enemy Generators...9 Object Tags...14 Projectile Collision...16 Enemy

More information

Star Defender. Section 1

Star Defender. Section 1 Star Defender Section 1 For the first full Construct 2 game, you're going to create a space shooter game called Star Defender. In this game, you'll create a space ship that will be able to destroy the

More information

Adding in 3D Models and Animations

Adding in 3D Models and Animations Adding in 3D Models and Animations We ve got a fairly complete small game so far but it needs some models to make it look nice, this next set of tutorials will help improve this. They are all about importing

More information

COMPUTING CURRICULUM TOOLKIT

COMPUTING CURRICULUM TOOLKIT COMPUTING CURRICULUM TOOLKIT Pong Tutorial Beginners Guide to Fusion 2.5 Learn the basics of Logic and Loops Use Graphics Library to add existing Objects to a game Add Scores and Lives to a game Use Collisions

More information

Tutorial: A scrolling shooter

Tutorial: A scrolling shooter Tutorial: A scrolling shooter Copyright 2003-2004, Mark Overmars Last changed: September 2, 2004 Uses: version 6.0, advanced mode Level: Beginner Scrolling shooters are a very popular type of arcade action

More information

Space Invadersesque 2D shooter

Space Invadersesque 2D shooter Space Invadersesque 2D shooter So, we re going to create another classic game here, one of space invaders, this assumes some basic 2D knowledge and is one in a beginning 2D game series of shorts. All in

More information

How to Make Smog Cloud Madness in GameSalad

How to Make Smog Cloud Madness in GameSalad How to Make Smog Cloud Madness in GameSalad by J. Matthew Griffis Note: this is an Intermediate level tutorial. It is recommended, though not required, to read the separate PDF GameSalad Basics and go

More information

Create Your Own World

Create Your Own World Create Your Own World Introduction In this project you ll learn how to create your own open world adventure game. Step 1: Coding your player Let s start by creating a player that can move around your world.

More information

GAME:IT Junior Bouncing Ball

GAME:IT Junior Bouncing Ball GAME:IT Junior Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game All games need sprites (which are just pictures) that, in of themselves, do nothing.

More information

Overview. The Game Idea

Overview. The Game Idea Page 1 of 19 Overview Even though GameMaker:Studio is easy to use, getting the hang of it can be a bit difficult at first, especially if you have had no prior experience of programming. This tutorial is

More information

Project 1: Game of Bricks

Project 1: Game of Bricks Project 1: Game of Bricks Game Description This is a game you play with a ball and a flat paddle. A number of bricks are lined up at the top of the screen. As the ball bounces up and down you use the paddle

More information

GameSalad Basics. by J. Matthew Griffis

GameSalad Basics. by J. Matthew Griffis GameSalad Basics by J. Matthew Griffis [Click here to jump to Tips and Tricks!] General usage and terminology When we first open GameSalad we see something like this: Templates: GameSalad includes templates

More information

1 Shooting Gallery Guide 2 SETUP. Unzip the ShootingGalleryFiles.zip file to a convenient location.

1 Shooting Gallery Guide 2 SETUP. Unzip the ShootingGalleryFiles.zip file to a convenient location. 1 Shooting Gallery Guide 2 SETUP Unzip the ShootingGalleryFiles.zip file to a convenient location. In the file explorer, go to the View tab and check File name extensions. This will show you the three

More information

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading) The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? [Note: This lab isn t as complete as the others we have done in this class. There are no self-assessment questions and no post-lab

More information

Annex IV - Stencyl Tutorial

Annex IV - Stencyl Tutorial Annex IV - Stencyl Tutorial This short, hands-on tutorial will walk you through the steps needed to create a simple platformer using premade content, so that you can become familiar with the main parts

More information

GameMaker. Adrienne Decker School of Interactive Games and Media. RIT Center for Media, Arts, Games, Interaction & Creativity (MAGIC)

GameMaker. Adrienne Decker School of Interactive Games and Media. RIT Center for Media, Arts, Games, Interaction & Creativity (MAGIC) GameMaker Adrienne Decker School of Interactive Games and Media (MAGIC) adrienne.decker@rit.edu Agenda Introductions and Installations GameMaker Introductory Walk-through Free time to explore and create

More information

5: The Robots are Coming!

5: The Robots are Coming! 5: The Robots are Coming! Gareth McCaughan Revision 1.8, May 14, 2001 Credits c Gareth McCaughan. All rights reserved. This document is part of the LiveWires Python Course. You may modify and/or distribute

More information

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell!

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell! Entering Space Magic star web! Alright! I can feel my limbs again! sh WhoO The Dark Wizard? Nice work! You ve broken the Dark Wizard s spell! My name is Gobo. I m a cosmic defender! That solar flare destroyed

More information

Kodu Game Programming

Kodu Game Programming Kodu Game Programming Have you ever played a game on your computer or gaming console and wondered how the game was actually made? And have you ever played a game and then wondered whether you could make

More information

No Evidence. What am I Testing? Expected Outcomes Testing Method Actual Outcome Action Required

No Evidence. What am I Testing? Expected Outcomes Testing Method Actual Outcome Action Required No Evidence What am I Testing? Expected Outcomes Testing Method Actual Outcome Action Required If a game win is triggered if the player wins. If the ship noise triggered when the player loses. If the sound

More information

Lab 7: 3D Tic-Tac-Toe

Lab 7: 3D Tic-Tac-Toe Lab 7: 3D Tic-Tac-Toe Overview: Khan Academy has a great video that shows how to create a memory game. This is followed by getting you started in creating a tic-tac-toe game. Both games use a 2D grid or

More information

GAME:IT Junior Bouncing Ball

GAME:IT Junior Bouncing Ball GAME:IT Junior Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game All games need sprites (which are just pictures) that, in of themselves, do nothing.

More information

Table of contents. Game manual. Dear Julius 4. Keyboard controls 5. Controller controls 6. katsh# controls 7. User interface 8.

Table of contents. Game manual. Dear Julius 4. Keyboard controls 5. Controller controls 6. katsh# controls 7. User interface 8. I + I.. l l Table of contents Dear Julius 4 Keyboard controls 5 Controller controls 6 katsh# controls 7 User interface 8 Tiles 9 Logic operations 15 3 From: KT at 0x500A92A9C To: Julius Leopold 1.42 rev.

More information

Maze Puzzler Beta. 7. Somewhere else in the room place locks to impede the player s movement.

Maze Puzzler Beta. 7. Somewhere else in the room place locks to impede the player s movement. Maze Puzzler Beta 1. Open the Alpha build of Maze Puzzler. 2. Create the following Sprites and Objects: Sprite Name Image File Object Name SPR_Detonator_Down Detonator_On.png OBJ_Detonator_Down SPR_Detonator_Up

More information

Create Your Own World

Create Your Own World Scratch 2 Create Your Own World All Code Clubs must be registered. Registered clubs appear on the map at codeclubworld.org - if your club is not on the map then visit jumpto.cc/ccwreg to register your

More information

5.0 Events and Actions

5.0 Events and Actions 5.0 Events and Actions So far, we ve defined the objects that we will be using and allocated movement to particular objects. But we still need to know some more information before we can create an actual

More information

Introduction to Turtle Art

Introduction to Turtle Art Introduction to Turtle Art The Turtle Art interface has three basic menu options: New: Creates a new Turtle Art project Open: Allows you to open a Turtle Art project which has been saved onto the computer

More information

understanding sensors

understanding sensors The LEGO MINDSTORMS EV3 set includes three types of sensors: Touch, Color, and Infrared. You can use these sensors to make your robot respond to its environment. For example, you can program your robot

More information

Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game

Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game GAME:IT Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game All games need sprites (which are just pictures) that, in of themselves, do nothing. They are

More information

Competitive Games: Playing Fair with Tanks

Competitive Games: Playing Fair with Tanks CHAPTER 10 Competitive Games: Playing Fair with Tanks Combat arenas are a popular theme in multiplayer games, because they create extremely compelling gameplay from very simple ingredients. This can often

More information

Save System for Realistic FPS Prefab. Copyright Pixel Crushers. All rights reserved. Realistic FPS Prefab Azuline Studios.

Save System for Realistic FPS Prefab. Copyright Pixel Crushers. All rights reserved. Realistic FPS Prefab Azuline Studios. User Guide v1.1 Save System for Realistic FPS Prefab Copyright Pixel Crushers. All rights reserved. Realistic FPS Prefab Azuline Studios. Contents Chapter 1: Welcome to Save System for RFPSP...4 How to

More information

Cato s Hike Quick Start

Cato s Hike Quick Start Cato s Hike Quick Start Version 1.1 Introduction Cato s Hike is a fun game to teach children and young adults the basics of programming and logic in an engaging game. You don t need any experience to play

More information

Scratch for Beginners Workbook

Scratch for Beginners Workbook for Beginners Workbook In this workshop you will be using a software called, a drag-anddrop style software you can use to build your own games. You can learn fundamental programming principles without

More information

The purpose of this document is to help users create their own TimeSplitters Future Perfect maps. It is designed as a brief overview for beginners.

The purpose of this document is to help users create their own TimeSplitters Future Perfect maps. It is designed as a brief overview for beginners. MAP MAKER GUIDE 2005 Free Radical Design Ltd. "TimeSplitters", "TimeSplitters Future Perfect", "Free Radical Design" and all associated logos are trademarks of Free Radical Design Ltd. All rights reserved.

More information

Signaling Crossing Tracks and Double Track Junctions

Signaling Crossing Tracks and Double Track Junctions Signaling Crossing Tracks and Double Track Junctions Welcome. In this tutorial, we ll discuss tracks that cross each other and how to keep trains from colliding when they reach the crossing at the same

More information

DESIGN A SHOOTING STYLE GAME IN FLASH 8

DESIGN A SHOOTING STYLE GAME IN FLASH 8 DESIGN A SHOOTING STYLE GAME IN FLASH 8 In this tutorial, you will learn how to make a basic arcade style shooting game in Flash 8. An example of the type of game you will create is the game Mozzie Blitz

More information

Tac Due: Sep. 26, 2012

Tac Due: Sep. 26, 2012 CS 195N 2D Game Engines Andy van Dam Tac Due: Sep. 26, 2012 Introduction This assignment involves a much more complex game than Tic-Tac-Toe, and in order to create it you ll need to add several features

More information

Final Project: NOTE: The final project will be due on the last day of class, Friday, Dec 9 at midnight.

Final Project: NOTE: The final project will be due on the last day of class, Friday, Dec 9 at midnight. Final Project: NOTE: The final project will be due on the last day of class, Friday, Dec 9 at midnight. For this project, you may work with a partner, or you may choose to work alone. If you choose to

More information

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours! Memory Introduction In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours! Step 1: Random colours First, let s create a character that can change

More information

How to Make Games in MakeCode Arcade Created by Isaac Wellish. Last updated on :10:15 PM UTC

How to Make Games in MakeCode Arcade Created by Isaac Wellish. Last updated on :10:15 PM UTC How to Make Games in MakeCode Arcade Created by Isaac Wellish Last updated on 2019-04-04 07:10:15 PM UTC Overview Get your joysticks ready, we're throwing an arcade party with games designed by you & me!

More information

knitcompanion NextGen for ios Reference Guide

knitcompanion NextGen for ios Reference Guide Contents Options... 2 Home Page... 3 Main Knitting Page Knit Mode... 7 Main Knitting Page Edit Mode... 12 Linked Counters... 16 PDF Viewer... 18 Magic Markers... 20 Setup Mode... 22 Smart Counters... 27

More information

Chapter 14. using data wires

Chapter 14. using data wires Chapter 14. using data wires In this fifth part of the book, you ll learn how to use data wires (this chapter), Data Operations blocks (Chapter 15), and variables (Chapter 16) to create more advanced programs

More information

Assignment II: Set. Objective. Materials

Assignment II: Set. Objective. Materials Assignment II: Set Objective The goal of this assignment is to give you an opportunity to create your first app completely from scratch by yourself. It is similar enough to assignment 1 that you should

More information

Game Design Curriculum Multimedia Fusion 2. Created by Rahul Khurana. Copyright, VisionTech Camps & Classes

Game Design Curriculum Multimedia Fusion 2. Created by Rahul Khurana. Copyright, VisionTech Camps & Classes Game Design Curriculum Multimedia Fusion 2 Before starting the class, introduce the class rules (general behavioral etiquette). Remind students to be careful about walking around the classroom as there

More information

The Slide Master and Sections for Organization: Inserting, Deleting, and Moving Around Slides and Sections

The Slide Master and Sections for Organization: Inserting, Deleting, and Moving Around Slides and Sections The Slide Master and Sections for Organization: Inserting, Deleting, and Moving Around Slides and Sections Welcome to the next lesson in the third module of this PowerPoint course. This time around, we

More information

GAME:IT Bouncing Ball

GAME:IT Bouncing Ball GAME:IT Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game All games need sprites (which are just pictures) that, in of themselves, do nothing. They are

More information

More Actions: A Galaxy of Possibilities

More Actions: A Galaxy of Possibilities CHAPTER 3 More Actions: A Galaxy of Possibilities We hope you enjoyed making Evil Clutches and that it gave you a sense of how easy Game Maker is to use. However, you can achieve so much with a bit more

More information

Design of Embedded Systems - Advanced Course Project

Design of Embedded Systems - Advanced Course Project 2011-10-31 Bomberman A Design of Embedded Systems - Advanced Course Project Linus Sandén, Mikael Göransson & Michael Lennartsson et07ls4@student.lth.se, et07mg7@student.lth.se, mt06ml8@student.lth.se Abstract

More information

Game Making Workshop on Scratch

Game Making Workshop on Scratch CODING Game Making Workshop on Scratch Learning Outcomes In this project, students create a simple game using Scratch. They key learning outcomes are: Video games are made from pictures and step-by-step

More information

CONCEPTS EXPLAINED CONCEPTS (IN ORDER)

CONCEPTS EXPLAINED CONCEPTS (IN ORDER) CONCEPTS EXPLAINED This reference is a companion to the Tutorials for the purpose of providing deeper explanations of concepts related to game designing and building. This reference will be updated with

More information

CSSE220 BomberMan programming assignment Team Project

CSSE220 BomberMan programming assignment Team Project CSSE220 BomberMan programming assignment Team Project You will write a game that is patterned off the 1980 s BomberMan game. You can find a description of the game, and much more information here: http://strategywiki.org/wiki/bomberman

More information

Foreword Thank you for purchasing the Motion Controller!

Foreword Thank you for purchasing the Motion Controller! Foreword Thank you for purchasing the Motion Controller! I m an independent developer and your feedback and support really means a lot to me. Please don t ever hesitate to contact me if you have a question,

More information

Your First Game: Devilishly Easy

Your First Game: Devilishly Easy C H A P T E R 2 Your First Game: Devilishly Easy Learning something new is always a little daunting at first, but things will start to become familiar in no time. In fact, by the end of this chapter, you

More information

Instructor (Mehran Sahami):

Instructor (Mehran Sahami): Programming Methodology-Lecture21 Instructor (Mehran Sahami): So welcome back to the beginning of week eight. We're getting down to the end. Well, we've got a few more weeks to go. It feels like we're

More information

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours! Scratch 2 Memory All Code Clubs must be registered. Registered clubs appear on the map at codeclubworld.org - if your club is not on the map then visit jumpto.cc/ccwreg to register your club. Introduction

More information

Welcome to the Sudoku and Kakuro Help File.

Welcome to the Sudoku and Kakuro Help File. HELP FILE Welcome to the Sudoku and Kakuro Help File. This help file contains information on how to play each of these challenging games, as well as simple strategies that will have you solving the harder

More information

Excel 2016 Cell referencing and AutoFill

Excel 2016 Cell referencing and AutoFill Excel 2016 Cell referencing and AutoFill Good afternoon everyone and welcome to Student Tech Bytes. My name is Liza and today we are here for Excel Cell referencing and Autofill. Today s session will be

More information

Unit 6.5 Text Adventures

Unit 6.5 Text Adventures Unit 6.5 Text Adventures Year Group: 6 Number of Lessons: 4 1 Year 6 Medium Term Plan Lesson Aims Success Criteria 1 To find out what a text adventure is. To plan a story adventure. Children can describe

More information

Scratch Coding And Geometry

Scratch Coding And Geometry Scratch Coding And Geometry by Alex Reyes Digitalmaestro.org Digital Maestro Magazine Table of Contents Table of Contents... 2 Basic Geometric Shapes... 3 Moving Sprites... 3 Drawing A Square... 7 Drawing

More information

Chief Architect X3 Training Series. Layers and Layer Sets

Chief Architect X3 Training Series. Layers and Layer Sets Chief Architect X3 Training Series Layers and Layer Sets Save time while creating more detailed plans Why do you need Layers? Setting up Layer Lets Adding items to layers Layers and Layout Pages Layer

More information

Introducing Scratch Game development does not have to be difficult or expensive. The Lifelong Kindergarten Lab at Massachusetts Institute

Introducing Scratch Game development does not have to be difficult or expensive. The Lifelong Kindergarten Lab at Massachusetts Institute Building Games and Animations With Scratch By Andy Harris Computers can be fun no doubt about it, and computer games and animations can be especially appealing. While not all games are good for kids (in

More information

Building a Chart Using Trick or Treat Data a step by step guide By Jeffrey A. Shaffer

Building a Chart Using Trick or Treat Data a step by step guide By Jeffrey A. Shaffer Building a Chart Using Trick or Treat Data a step by step guide By Jeffrey A. Shaffer Each year my home is bombarded on Halloween with an incredible amount of Trick or Treaters. So what else would an analytics

More information

EE307. Frogger. Project #2. Zach Miller & John Tooker. Lab Work: 11/11/ /23/2008 Report: 11/25/2008

EE307. Frogger. Project #2. Zach Miller & John Tooker. Lab Work: 11/11/ /23/2008 Report: 11/25/2008 EE307 Frogger Project #2 Zach Miller & John Tooker Lab Work: 11/11/2008-11/23/2008 Report: 11/25/2008 This document details the work completed on the Frogger project from its conception and design, through

More information

Creating Photo Borders With Photoshop Brushes

Creating Photo Borders With Photoshop Brushes Creating Photo Borders With Photoshop Brushes Written by Steve Patterson. In this Photoshop photo effects tutorial, we ll learn how to create interesting photo border effects using Photoshop s brushes.

More information

Princess & Dragon Version 2

Princess & Dragon Version 2 Princess & Dragon Version 2 Part 3: Billboards, Events, Sounds, 3D text and Properties By Michael Hoyle under the direction of Professor Susan Rodger Duke University July 2012 Overview In this last part,

More information

Environmental Stochasticity: Roc Flu Macro

Environmental Stochasticity: Roc Flu Macro POPULATION MODELS Environmental Stochasticity: Roc Flu Macro Terri Donovan recorded: January, 2010 All right - let's take a look at how you would use a spreadsheet to go ahead and do many, many, many simulations

More information

we re doing all of the background, then we stop. We put on the borders and then we come back and we ll finish out the eagle.

we re doing all of the background, then we stop. We put on the borders and then we come back and we ll finish out the eagle. I was so lucky to be standing on the upper deck of this cruise ship in Sitka, Alaska when this bald eagle flew right over the top of me and I had my camera with me. So of course I got very inspired and

More information

Programming Project 2

Programming Project 2 Programming Project 2 Design Due: 30 April, in class Program Due: 9 May, 4pm (late days cannot be used on either part) Handout 13 CSCI 134: Spring, 2008 23 April Space Invaders Space Invaders has a long

More information

Module 3. People To Follow Me?

Module 3. People To Follow Me? Twitter Module 3 Session 2: How Do I Get People To Follow Me? Table of Contents Are You Easy To Find? 1 Did You Optimize Bio For Keywords? 1 Are You Tweeting Regularly? 1 Is Profile Follow Worth? 2 Interacting

More information

UNDERSTANDING LAYER MASKS IN PHOTOSHOP

UNDERSTANDING LAYER MASKS IN PHOTOSHOP UNDERSTANDING LAYER MASKS IN PHOTOSHOP In this Adobe Photoshop tutorial, we re going to look at one of the most essential features in all of Photoshop - layer masks. We ll cover exactly what layer masks

More information

CHAPTER 17 Matridia II: The Project

CHAPTER 17 Matridia II: The Project 17_actionscript.qxd 10/14/03 7:37 AM Page 351 CHAPTER 17 Matridia II: The Project 17_actionscript.qxd 10/14/03 7:37 AM Page 352 352 17. Matridia II: The Project You ve made it through the work, and now

More information

Creating Journey In AgentCubes

Creating Journey In AgentCubes DRAFT 3-D Journey Creating Journey In AgentCubes Student Version No AgentCubes Experience You are a traveler on a journey to find a treasure. You travel on the ground amid walls, chased by one or more

More information

Some code for this game has been provided for you. Open this trinket: This is a very basic RPG game that only has 2 rooms. Here s a map of the game:

Some code for this game has been provided for you. Open this trinket: This is a very basic RPG game that only has 2 rooms. Here s a map of the game: RPG Introduction: In this project, you ll design and code your own RPG maze game. The aim of the game will be to collect objects and escape from a house, making sure to avoid all the monsters! Step 1:

More information

Interactive 1 Player Checkers. Harrison Okun December 9, 2015

Interactive 1 Player Checkers. Harrison Okun December 9, 2015 Interactive 1 Player Checkers Harrison Okun December 9, 2015 1 Introduction The goal of our project was to allow a human player to move physical checkers pieces on a board, and play against a computer's

More information

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm Weight: 8% Individual Work: All assignments in this course are to be completed individually. Students are advised to read the guidelines

More information

Create Or Conquer Game Development Guide

Create Or Conquer Game Development Guide Create Or Conquer Game Development Guide Version 1.2.5 Thursday, January 18, 2007 Author: Rob rob@createorconquer.com Game Development Guide...1 Getting Started, Understand the World Building System...3

More information

Girls Programming Network. Scissors Paper Rock!

Girls Programming Network. Scissors Paper Rock! Girls Programming Network Scissors Paper Rock! This project was created by GPN Australia for GPN sites all around Australia! This workbook and related materials were created by tutors at: Sydney, Canberra

More information

Editing the standing Lazarus object to detect for being freed

Editing the standing Lazarus object to detect for being freed Lazarus: Stages 5, 6, & 7 Of the game builds you have done so far, Lazarus has had the most programming properties. In the big picture, the programming, animation, gameplay of Lazarus is relatively simple.

More information

Flappy Parrot Level 2

Flappy Parrot Level 2 Flappy Parrot Level 2 These projects are for use outside the UK only. More information is available on our website at http://www.codeclub.org.uk/. This coursework is developed in the open on GitHub, https://github.com/codeclub/

More information

Comprehensive Rules Document v1.1

Comprehensive Rules Document v1.1 Comprehensive Rules Document v1.1 Contents 1. Game Concepts 100. General 101. The Golden Rule 102. Players 103. Starting the Game 104. Ending The Game 105. Kairu 106. Cards 107. Characters 108. Abilities

More information

Game Maker: Platform Game

Game Maker: Platform Game TABLE OF CONTENTS LESSON 1 - BASIC PLATFORM...3 RESOURCE FILES... 4 SPRITES... 4 OBJECTS... 5 EVENTS/ACTION SUMMARY... 5 EVENTS/ACTION SUMMARY... 7 LESSON 2 - ADDING BACKGROUNDS...8 RESOURCE FILES... 8

More information

The Basics. Introducing PaintShop Pro X4 CHAPTER 1. What s Covered in this Chapter

The Basics. Introducing PaintShop Pro X4 CHAPTER 1. What s Covered in this Chapter CHAPTER 1 The Basics Introducing PaintShop Pro X4 What s Covered in this Chapter This chapter explains what PaintShop Pro X4 can do and how it works. If you re new to the program, I d strongly recommend

More information

AIM OF THE GAME GLACIER RACE. Glacier Race. Ben Gems: 20. Laura Gems: 13

AIM OF THE GAME GLACIER RACE. Glacier Race. Ben Gems: 20. Laura Gems: 13 Glacier Race 166 GLACIER RACE How to build Glacier Race Glacier Race is a two-player game in which you race up the screen, swerving around obstacles and collecting gems as you go. There s no finish line

More information

Created by: Susan Miller, University of Colorado, School of Education

Created by: Susan Miller, University of Colorado, School of Education You are a warehouse keeper (Sokoban) who is in a maze. You must push boxes around the maze while trying to put them in the designated locations. Only one box may be pushed at a time, and boxes cannot be

More information

Chapter 1:Object Interaction with Blueprints. Creating a project and the first level

Chapter 1:Object Interaction with Blueprints. Creating a project and the first level Chapter 1:Object Interaction with Blueprints Creating a project and the first level Setting a template for a new project Making sense of the project settings Creating the project 2 Adding objects to our

More information

Module All You Ever Need to Know About The Displace Filter

Module All You Ever Need to Know About The Displace Filter Module 02-05 All You Ever Need to Know About The Displace Filter 02-05 All You Ever Need to Know About The Displace Filter [00:00:00] In this video, we're going to talk about the Displace Filter in Photoshop.

More information

Learn Unity by Creating a 3D Multi-Level Platformer Game

Learn Unity by Creating a 3D Multi-Level Platformer Game Learn Unity by Creating a 3D Multi-Level Platformer Game By Pablo Farias Navarro Certified Unity Developer and Founder of Zenva Table of Contents Introduction Tutorial requirements and project files Scene

More information

The lump sum amount that a series of future payments is worth now; used to calculate loan payments; also known as present value function Module 3

The lump sum amount that a series of future payments is worth now; used to calculate loan payments; also known as present value function Module 3 Microsoft Excel Formulas Made Easy Key Terms Term Definition Introduced In Absolute reference A cell reference that is fixed to a specific cell and contains a constant value throughout the spreadsheet

More information

The Joy of SVGs CUT ABOVE. pre training series 3. svg design Course. Jennifer Maker. CUT ABOVE SVG Design Course by Jennifer Maker

The Joy of SVGs CUT ABOVE. pre training series 3. svg design Course. Jennifer Maker. CUT ABOVE SVG Design Course by Jennifer Maker CUT ABOVE svg design Course pre training series 3 The Joy of SVGs by award-winning graphic designer and bestselling author Jennifer Maker Copyright Jennifer Maker page 1 please Do not copy or share Session

More information

Term Definition Introduced in:

Term Definition Introduced in: 60 Minutes of Access Secrets Key Terms Term Definition Introduced in: Calculated Field A field that displays the results of a calculation. Introduced in Access 2010, this field allows you to make calculations

More information

The horse image used for this tutorial comes from Capgros at the Stock Exchange. The rest are mine.

The horse image used for this tutorial comes from Capgros at the Stock Exchange. The rest are mine. First off, sorry to those of you that are on the mailing list or RSS that get this twice. I m finally moved over to a dedicated server, and in doing so, this post was lost. So, I m republishing it. This

More information

PING. Table of Contents. PING GameMaker Studio Assignment CIS 125G 1. Lane Community College 2015

PING. Table of Contents. PING GameMaker Studio Assignment CIS 125G 1. Lane Community College 2015 PING GameMaker Studio Assignment CIS 125G 1 PING Lane Community College 2015 Table of Contents SECTION 0 OVERVIEW... 2 SECTION 1 RESOURCES... 3 SECTION 2 PLAYING THE GAME... 4 SECTION 3 UNDERSTANDING THE

More information

Module 5, Lesson 1 Webinars That Convert Automated Planning Phase: The Automated Webinar Funnel

Module 5, Lesson 1 Webinars That Convert Automated Planning Phase: The Automated Webinar Funnel Module 5, Lesson 1 Webinars That Convert Automated Planning Phase: The Automated Webinar Funnel Oh my goodness, get up and do a little happy dance right now because you have made it to Module 5, The Automated

More information

Copyright 2017 MakeUseOf. All Rights Reserved.

Copyright 2017 MakeUseOf. All Rights Reserved. Make Your Own Mario Game! Scratch Basics for Kids and Adults Written by Ben Stegner Published April 2017. Read the original article here: http://www.makeuseof.com/tag/make-mario-game-scratchbasics-kids-adults/

More information