Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sprite sets. project of the week: bubble popper o objects appear from the bottom and slide up o player needs to avoid objects to earn points (objects.

Similar presentations


Presentation on theme: "Sprite sets. project of the week: bubble popper o objects appear from the bottom and slide up o player needs to avoid objects to earn points (objects."— Presentation transcript:

1 sprite sets

2 project of the week: bubble popper o objects appear from the bottom and slide up o player needs to avoid objects to earn points (objects re- spawn at the bottom) o “bad bubbles” also move up, player loses life if overlaps

3 learning targets Increase awareness of the struggles that of game development; Recognize computer science elements for game logic; Applying CS vocabulary to coding logic

4 sprite sets physics engine + graphics

5 entry task 1. Write down the basic programming logic for app 2. Write line of learning underneath your explanation 3. Turn and talk with neighbor for pair - share… Write additional answers to game logic underneath 4. Classroom share out… Groups discuss their answers

6 activity Code tutorial: touchdevelop.com/cxlr

7 Write down an answer for each question. o how will the bubbles move? o what should happen when a bubble reaches the top of the screen? o how will you place the bubbles on the screen? o how many sprite sets do you need for this game? What will they contain? o how will you detect taps on the bubbles? o how will you keep track of the score? When does the score go up? o how will you keep track of the life? When does the life go down? o When does the game finish?

8 Bubble Popper - Extensions To recap, Here are ideas to make the bubble popper better: You must select 3 of 6 options below, publish script 1. Create bubbles of different sizes (hint: use math->random range to get a random range of size) 2. Use different images for bubbles (hint: you can change the sprite picture by using sprite->set picture) 3. As bubble pops, a different image appears 4. Make the bubbles move slightly left and right… like real bubbles ((hint: use math->random range to get a random range of speed) 5. Make the bubbles have slightly different speeds (hint: use math->random range to get a random range of speed) 6. Add a set bubbles worth extra points. 7. Different sounds when bubble popping.

9 word wall o board: boundary, game board o sprite: single object o sprite set: collection of objects o physics: gravity, set speed (x,y), random range (x,y) o for loop o for each o add on every frame o overlaps with

10 coordinates and units o positions are based on pixels o origin (0, 0) is top left corner o extent (width,height) is just outside of bottom right corner X: width pixel Y: height pixel (0,0) (width/2,height/2) (width,height)

11 coordinates and units o sprite positions refer to center of sprite (makes rotation easy) o speed measured in pixels/second o acceleration measured in pixels/second 2

12 demo/exercise: static layout action main var board := game→start board→create ellipse(20,20) game is a library, you need to add it to your project. X ellipse +(20,20) Y (0,0)

13 create ellipse create ellipse(w, h) o w is width of enclosing rectangle o h is height w h

14 picture sprite o use create picture instead of create ellipse o resize the picture sprite := board->create picture(art->fruit) sprite := board->create picture(pic) sprite->set width(200)

15 sprite sets o a sprite set allows to register events for a group of sprites. create sprite set var sprites := board->create sprite set add sprite to sprite set sprites->add(sprite) register tap events on sprite set (next slide) iterate through the sprite in a sprite set for each sprite in sprite set where true do |... Initializes a sprite set

16 sprite in sprite set dissapears o sprite overlap in a sprite set is an event raised when the sprite collides with any sprite from a sprite set. o Attaches to an add on every frame (perform). where perform is for each sprite2 in sprite where true do if sprite 2->y> board ->height sprite2->set y(-300) else sprite->set y (board->height *3/4) sprite->set width(100) sprite disappears (y) is the coordinate range of the sprite without contacting sprite in sprite set

17 testing border o is the sprite on the left? board->add every frame(perform) where perform() if sprite->x vibrate(0.1) else (50,0) (0,0) ( sprite→ x, sprite→ y)

18 exercise o is the sprite on the top? board->add every frame(perform) where perform() if _____________________ then phone->vibrate(0.1) else (0,0) ( sprite→ x, sprite→ y) (0,50)

19 demo: gravity action main var board := game→start board→create ellipse(20,20) board→add on every frame(perform) where perform() X ellipse +(20,20) Y (0,0) (p→x, p→y)

20 demo:sprite lateral movement action main var board := game→start var sprite:= board→create ellipse(20,20) X ellipse +(20,20) Y (0,0) (p→x, p→y)

21 o is the sprite on the left or bottom? board->add every frame(perform) where perform() if _________________________ then phone->vibrate(0.1) else (0,0) ( sprite→ x, sprite→ y) (0,50) exercise

22 o create a game where 1 sprite (called ball ) moves across the screen balloons increase in speed

23 score/life o Add 100 points game->add score(100) o remove a life: game->remove life(1)

24 project pitch o 2 min: prepare a 1 minute demo/story why someone should buy your game. o At each “beep”, pick a new student and pitch each other’s game. Mark down the other student’s name and whether you would pay.99c to buy his game. TOMORROW, YOU WILL DO THIS PITCH TO THE SHARKS (TEACHERS OR ADMIN) !

25 Student’s Name, Script IDBuy YES!Buy NO! Your Name: _____________________

26 Student’s Name, Script IDBuy YES!Buy NO! Your Name: _____________________


Download ppt "Sprite sets. project of the week: bubble popper o objects appear from the bottom and slide up o player needs to avoid objects to earn points (objects."

Similar presentations


Ads by Google