Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 8 Fall 2010.

Slides:



Advertisements
Similar presentations
Sprite-visual object (actor on the stage) Scripts- Tells actors (sprites) what to do.
Advertisements

Introduction to Macromedia Director 8.5 – Lingo
Create a Simple Game in Scratch
Create a Simple Game in Scratch
Scratch for Storytelling Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Introduction to TouchDevelop
A Christmas Scratch game
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 07 Fall 2010.
Justus Nyagwencha Game Maker. Getting started -> Resources The icons across the top are very important All the things you add to the game are called “Resources”.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
ABC’s of PowerPoint (Office 2007) Part 1: Basic Vocabulary Part 2: Cursors Part 3: Insert Your Text Part 4: Insert Your Pictures Part 5: Basic Tools &
Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Rodger Duke University, July 2008.
Wizard Game: Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July
GAME:IT Junior Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game.
GameMaker.  A lot of Different Definitions  Easier to Say What is NOT a Game  Movie is Not a Game  No Active Participation  Final Outcome is Fixed.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
01-Intro-Object-Oriented-Prog-Alice1 Barb Ericson Georgia Institute of Technology Aug 2009 Introduction to Object-Oriented Programming in Alice.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
Programming for Everyone How is Making Programming More Accessible, Meaningful, and Social Mitchel Resnick MIT Media Lab.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
Animation II Art 311 Lecture 12 Dr. J.R. Parker Fall 2010.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Art 315 Lecture 4 Dr. J. Parker AB 606 Today’s class: Programming! We are going to write some simple programs. We will use a tool called GameMaker –It.
In.  This presentation will only make sense if you view it in presentation mode (hit F5). If you don’t do that there will be multiple slides that are.
Introduction to TouchDevelop
Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other.
Introduction to Scratch!
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Invitation to Computer Science, Java Version, Second Edition.
Art 315 Lecture 5 Dr. J. Parker AB 606. Last time … We wrote our first program. We used a tool called GameMaker. The program we wrote causes a ball to.
Art 315 Lecture 6 Dr. J. Parker. Variables Variables are one of a few key concepts in programming that must be understood. Many engineering/cs students.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 11 Fall 2010.
Art 321 Lecture 7 Dr. J. Parker. Programming In order to ‘make things happen’ on a computer, you really have to program it. Programming is not hard and.
Moving Around in Scratch The Basics… -You do want to have Scratch open as you will be creating a program. -Follow the instructions and if you have questions.
Introduction to PowerPoint Curriculum Implementation Day Friday, November 3, 2006 K.J. Benoy.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
GAME:IT Helicopter Objectives: Review skills in making directional sprites Create objects that shoot and destroy for points Create random enemies on the.
Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent
Art 321 VIDEO Dr. J. Parker AB 606. Recording and Editing Video All you frustrated Spielbergs out there now get your special lecture. First, let’s loot.
Game Maker – Getting Started What is Game Maker?.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
CRE Programming Club - Class 2 Robert Eckstein and Robert Heard.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
How to create a basic game in Scratch. The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high x increasesx decreases.
Introduction to TouchDevelop Lesson 3 – Comments & Lists Created by S. Johnson
HTML HTML stands for Hyper Text Markup Language. HTML is used in making the base of a Website You can just use an online website maker like weebly.com.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Class-Level Variables in Alice
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Intro to GML.
Learn… Create… Program
Go to =>
Learn… Create… Program
Scratch for Storytelling
Go to =>
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
Software Development Techniques
Presentation transcript:

Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 8 Fall 2010

Today - scripting Until now, our programming has been done largely by using pre-defined structures selected with the mouse. This works fine, and resembles a lot of what happens with recent software engineering templates and APIs. However, it (Mouse based) is slower and less flexible than using text, at least for small programs.

Script = program A script is a test version of a program in Game Maker, and is attached to an object, like a sprite. A script has to communicate the same things as does the point-and-click mouse program, so there must be symbols (text) that do this. A script (program) is written in a scripting language (programming language), which has a fixed set of these symbols and has a syntax (structure). Scripts are the more familiar type of computer program.

A script is text Count = 0

A script is text if (current_sprite) > 2

A script is text if (count > 120) { count = 0; current_sprite = 1; if (current_sprite > 2) current_sprite = 0; if (current_sprite==0) sprite_index= spr_electron; else if (current_sprite == 1) sprite_index = spr_proton; else sprite_index = spr_neutron; } count = count + 1;

We need to know more than we did! if (count > 120) Comparison needs to be enclosed { This symbol means ‘start block’ count = 0; Statements end with ‘;’ current_sprite = 1; current_sprite is our variable. if (current_sprite > 2) current_sprite = 0; if (current_sprite==0) ‘==‘ means ‘is equal to’ sprite_index= spr_electron; changes the sprite! else if (current_sprite == 1) sprite_index = spr_proton; else sprite_index = spr_neutron; } count = count + 1; Add 1 to count

We need to know more than we did! sprite_index= spr_electron; This is the name of a variable that the GameMaker system uses to keep track of the sprite being displayed. This is the name of the sprite for an electron. We gave it this name. New thing: there are a lot of names defined by Game Maker that we need to know in order to accomplish tasks using our program. Sprite_index used to be changed by the ‘change sprite’ command, and we did not need to know what the name of the variable was.

Variables and assignments Name = expression; This is an assignment, and gives the named variable a value. The value is expressed in terms of things whose value we already know, or it won’t mean anything. SO: x = 12; y = x+10; y = x*10; y = x/2; y = x-10; distance = x*x + y*y;

Variables and assignments List of variables: Game Maker also has functions. We have seen some: sine, for instance A function is really a name for something whose value is computed, each time you ask for it, perhaps depending on other variables or numbers. Sine is computed, and it depends on an angle that we give it. y = random (100); Sets the variable y to a random number between 0 and 99.

Variables and assignments y = random (100) Variable to get a new value. Function name, in this case the random number generator. Parameter – a value that determines the result of the function. There are many functions available, and you need to know their names to use them. Look them up at

Scripts A regular Gamemaker program is about objects and events. You manipulate those things directly using the mouse. A script is also about those things, but manipulates things by the use of their names (like wizards- if you know a wizard’s name, you can make him do what you want). Some names you make up, some you are provided.

Objects & Scripts Each object can have scripts associated with it, and those can be made to execute whenever you choose. When an event happens, is the usual situation. So let’s write a few short ones together. Ideas?

Motion Have an object move in a circle. An easy one…

Motion - initial.

Motion - step.

Result

Details We could use math to design this. Didn’t. I set the speed to 6 when the electron is created I then placed the electron in the room so that it circled the proton. This took a couple of tries. The faster the electron moves, the greater must be the direction change each step for a given radius.

Example 2 Off the top of my head …. How about an aquarium. Bubbles rise from the bottom and pop at the top. Oh, and bubbles get bigger as they rise! We need to find an aquaruium background, a popping sound, a bubble sprite.

Example 2 Sprites are easy. Use Google, search for images. Always attribute images in artworks and games, by the way. I edited the aquarium image to be the right size.

Example 2 So, new things. 1.Create a background for the room. Right click ‘backgrounds’, ‘new background’.

Example 2 So, new things. 1.Create a background for the room. Right click ‘backgrounds’, ‘new background’. Load Background (from an image file) OK Then, under ‘Room properties’/Backgrounds, load the image.

Load image as Background

New things 2: sounds 2. Load the sound Right click ‘sounds’, ‘new sound’. It’s like a sprite. Load the sound from the file you downloaded. OK

Create 3. Arrange the bubble object Create and assign the bubble sprite. Events: step Make it rise Increase size as it rises Sound when it reaches the top. Destroy it and create a new one at the bottom

New things 2: sounds Sounds-> new sound Sound file is ‘pop.mp3’ Name is ‘pop’

New things 3: script 3. Arrange the bubble object Create and assign the bubble sprite. Load the bubble image (center) into a new sprite. Create the bubble object, assign it the bubble sprite. Place some sprites in the room at the beginning

New things 3: script 3. Arrange the bubble object Create and assign the bubble sprite.

New things 3: script 3. Arrange the bubble object Step event Bubble moves upwards, gets bigger, and pops at the top of the water.

New things 3: script Sprite Basic action on each step is to run a script and then see if the bubble has reached the top. Script makes the Bubble change size.

New things 3: script 3. Arrange the bubble object Script Making the bubble get bigger means looking for a variable or function that will scale or resize the image. image_xscale and image_yscale allow you to specify a scale factor. 1.0 means use the basic size, 0.5 means half size, 2.0 means double size. Need to rescale in X and Y directions.

New things 3: script Room is 624 wide by 464 high. Aquarium ends at y=144 Aquarium width runs from So: as the bubble moves from 464 to 144, it gets bigger. (0,0) (0,464)

New things 3: script So the image is smallest (nearest to scale of 1.0) at the bottom (y=464) IE size is 1.0 of normal there. As bubble rises, y gets smaller so we can’t use Y to make the bubble grow. We *can* use 464-y, which gets bigger as y gets smaller (distance from bottom grows, so does bubble size). Scale = (464-y) ??

New things 3: script Scale = (464-y) ?? (at the top this is ( ) = 321! No, this gets too big. If the bubble is to double in size, then scale = 2.0 at the top, or scale = 2.0 at y=144 scale = s(464-y) So s = (2-1)/320 =

New things 3: script If you don’t like the arithmetic, note that my first implementation used Scale = (400-y) I jiggered it to be Scale = (400-y) This worked pretty well. THEN I did the math. So s =

New things 3: script Here’s the script. Xscale and yscale change as we said. Last line makes the bubble go Up. (y gets smaller).

New things 3: script Here it goes. (screen capture sound does not work)

New things 3: script The destroy/recreate places the new object instance at a random position within the bottom part of the aquarium.

Processing This is the last lecture on Game Maker. We know what it can teach us about programming. Questions?