gamesalad workbook windows-eng

Upload: crlca

Post on 03-Jun-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 GameSalad Workbook Windows-Eng

    1/10

    GameSaladWorkbook

  • 8/12/2019 GameSalad Workbook Windows-Eng

    2/10

    Gamesalad

    1

    The bene t of the drag-and-drop approachto programming is the lack of pressure tolearn a programming languages syntax.GameSalad provides just that. In addition isalso provides a friendly user-interface,attractive to both experienced users andnewcomers, as well as the range of assistanceavailable to users ranging from forums andhelp guides, to demo games, example codeand helpful videos.

    www.gamesalad.com

    1. GameSalad example ames

    Have a look at some of the pre-made ames, how do they work:

    Do these use timers?

    Do you build up a score?

    Do you manoeuvre between levels and screens?

    Are they 1-player or 2-player ames?

    Do you need to collect items or just avoid obstacles or enemies?

    When you open GameSalad, a new game is available, you also need to choose a title for your game by goinonto File, Save As and naming it. Once youve saved you can select between the tabs along the left handside of the interface, beneath Library. Tabs called Scenes , Layers, Actors, Media, Behaviors

    and Tables can be seen here and each leads to diff

    erent options displayed below.By clicking on the Scenes tab, you will be able to see a list of scenes in your game. As this is a new game,there is one scene readily available to you called Initial Scene. Using the + or - buttons on the right of thelibrary box, you can add or remove as many scenes as you like ready to start programming.

    2. Scenes

    Have a think about how many scenes you will require in your ame, re-namin themready to later create a form of navi ation between them all. Perhaps one for a Main Menuor a Game Over Screen? You could have a scene to identify each level.

    http://www.gamesalad.com/http://www.gamesalad.com/
  • 8/12/2019 GameSalad Workbook Windows-Eng

    3/10

    2

    GameSaladThis is the screen that would appearwhen you double click on one ofyour scenes, this editor allows you to

    add Actors, give them behavioursand begin developing your game.

    The black square on the right is theactual scene you are creating, thelighter grey band around the boxcan be used, but is not visible onyour screen when you upload yourgame onto your iPhone for example.

    On the left, the screen is split into 2, the top called library and the bottom section, titled Attributes, isdivided into 3 tabs: Game, Scene and Actor. If you select Behaviours, 36 diff erent behaviours appear to dragonto your code later on. If you select Images this displays your library of images ready to use in your gamat the moment this is empty because we havent added any. Sounds is also a library, but of sound eff ectsyou can use within your game. This is also empty at the moment, as nothing has been added just yet.

    3. Ima e Library

    Try addin some ima es and sounds into your library from your computer usin the + and- buttons on the ri ht of the library. As you be in selectin ima es/sounds you will be into see your library row.

    Note: These ima es/sounds are not automatically added to your ame, this is just alibrary storin ima es that you may use to add into your ame.

    In the library, select Actors. Here youcan add your actors into your game and

    give them images. You can do this bydragging an image from a folder openedin another window onto where it saysdrag an image here.

    To add your Actor onto your scene youneed to select it from the library and dragit onto the black square.

  • 8/12/2019 GameSalad Workbook Windows-Eng

    4/10

    GameSalad

    3

    A lot of characters in game characters are animated, which means the images is icking between diff erentinstances of the image.E.g. Your character may looks like he is walking when he moves, it is in fact in a loop changing between 2 omore images. The characters rst leg out stepping forward, another with the other leg behind.

    Double click on your main character fromyour Actors library, then click on thebutton that looks like this

    The scene on the right should appearallowing you to drag in combinations ofbehaviors and rules to give yourcharacters instructions.

    To achieve this ickering between images,there is a behaviour called Animate available in the library in the tab labelled behaviours. If you click onit and drag it into the section titled backstage, you should see it appear on the right, this is where you candrag your code to. You must drag in a sequence of images from your image library into the Animate boand alter the speed of the loop between the images, when you ick back onto your game scene and pressPreview you can see you character in action.The images can be found/added/removed from the Media

    tab in the library, using the + and - buttons. These are what you use to drag into your animation sequence.

    4. Animate your character

    Try animatin your own character, you can find a sequence of ima es that suit your ameand have a play with the speed that the ame is switchin between ima es. Themovements should look smooth and as if it were actually movin .

    Now that we have animated our main character, we need to tell it to respond when we press our arrow keys

    on our keyboard. By doing this our character will be able to move right, left, up and down around thescreen. This is where we introduce rules, meaning something will only happen under a certain condition.So, with the movement our character will only move left if the left arrow key is pressed, the character willonly move right if the right arrow key is pressed, and so on.

    We need to click + Rule button, we need to tell our character the condition: IF Actor receives event*key*. You must type key and press ENTER. Now you need to press on your keyboard which key youare programming followed by *is down* (referring to the key being depressed, not the direction).

    Underneath that, in do, we need to drag in the command to tell our character to move. We need to use theMove behaviour, here you can change it depending on the key you press.

  • 8/12/2019 GameSalad Workbook Windows-Eng

    5/10

    4

    GameSalad

    5. Character Movement

    Ensure your character moves in all four directions: Left, Ri ht, Up and Down usin either

    the arrows on your keyboard or usin W, A, S and D for a 2-player ame.You can also chan e the speed of the movement, default is 300 and ran es between 0and 500.

    Note: You can copy code by selecting the section and pressing the ctrl key and either C to copy or V paste. Be careful copying code and not editing all of the content, you may nd for example that if you pressthe right arrow, left arrow and the up arrow that the character all moves to the right because we forgot t

    change that part of the code.

    You can also shrink your code to clear up your screen, by using the arrow currently pointing down on the toline of the rule.

    6. Aim of the Game

    What is the aim of your ame: Is it to collect items? Is it to manoeuvre throu h yourobstacle within a specified time frame?

    This is where we need to consider how we are oin to pro ress our character throu hour ame. So far we have a back round and a character that moves.

    Note: Your background can consist of numerous Actors within your world, they will remain static as wedont have to give them any code instructing them to move. If we dont tell them what to do, they wont doanything!

    You can also add your own full background, this can be achieved by adding an Actor and them extending it

    to spread across your black screen. If it goes into the light-grey area then that bit that overlaps will not beseen on an iPod Screen or in the Preview of the ame.

  • 8/12/2019 GameSalad Workbook Windows-Eng

    6/10

    GameSalad

    5

    Collectables enable our character to move around or through the game gathering items that help add to thegame score. Firstly we need to know a bit about prototyping and how this can eff ectively save us a lot oftime without having to repeat code potentially hundreds of times.

    When we create a new Actor in our GameSalad Project this is stored in the Actors library. You will ndthat you can drag numerous copies of that created Actor, this also includes any code. The Actors within thelibrary (not the versions copied onto your game) are called a Prototypes. It is important to remember that ifyou drag on a copy onto your game and alter your prototypes code, it will automatically change them all. Bediting the instance of the Actor will only edit that singular copy.

    7. Collectables Prototypin

    Add a new actor to your library, an ima e you wish to use to move your character tocollect in your ame effectin your score.

    Click your prototype and add a new rule. Dra on a behaviour called Collision

    You can chan e the conditions for the rule to overlaps or collides with *select your mainactor* and you can use a behaviour called Destroy in do which removes the characterwhen the rules conditions are met (is the main character touchin the collectable?).

    Add one copy of your prototype into your game and click Preview to test it and see how it works. You caadd more if you are con dent the code works, but remember once you have made a copy of the prototypeyou cannot just change the prototypes code to eff ect all of the collectables now.

  • 8/12/2019 GameSalad Workbook Windows-Eng

    7/10

    6

    GameSaladNow we potentially have a method to collect a score throughout our game. We have the items to collect, thdisappear when we touch them but now we need to add an attribute to our game that can be altered anadded to throughout the game.

    In the Attributes box of your GameSalad project, there are 3 tabs Game, Scene and Actors. If you clicGame you can add a new one called Score using the + or - buttons below. This must have an Integer We must add a new Actor and then give it instructions to display the Score attribute - we do not need to githis an image. Before we add this Actor to our game, remember to give it code rst:

    We can tell the Actor to DisplayText by dragging that behaviourinto its code. But as you can see

    the default text is Hello World!.

    By clicking on the e on the right of the text box brings up the following screen, you can select AttribuGame and locate the Score attribute.

    You can then press the green tick box and beginediting the format your score will be displayedwithin the game.

    8. Score Attribute

    Usin the above instructions, try addin your own Score to your Game.

    You can chan e the formattin and font of the score, add it to your ame screen and testit usin the Preview button.

    Your score should start at 0 and as we have not yet iven our collectables any code totell it how to manipulate the score, the score should stay at 0 at this point.

  • 8/12/2019 GameSalad Workbook Windows-Eng

    8/10

    GameSalad

    7

    Now we need to tell our collectables to add to the score each time they are collected. We can do this byediting our collectable prototype and add code to tell our game to + to the score.Note: Remember, if you have already made copies of your collectable, changing your prototype will edit th

    ones already placed in your game, but changing the instances wont.

    9. Collectables Prototypin

    The Chan e Attribute behaviour is a behaviour enablin the user to set, chan e orincrement a value/attribute. As before you can press a and choose which attribute youwish to edit, in this case ame.Score. Then you can specify what you wish to chan e your attribut e to.

    You can re-select ame.Score usin the e next to the TO: text box, but before youpress the * reen tick* you can type + followed by the value you wish your charactercan achieve by collectin that particular Actor/Collectable.

    Below is an example:

    Note: Above we are usin a conditional rule that already existed from makin ourcollectables destroy on contact with our Main Character.

  • 8/12/2019 GameSalad Workbook Windows-Eng

    9/10

  • 8/12/2019 GameSalad Workbook Windows-Eng

    10/10

    www.technocamps.com

    http://www.technocamps.com/http://www.technocamps.com/