Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.sound.*;
- import sprites.*;
- import sprites.maths.*;
- import sprites.utils.*;
- PImage FirstbackG;
- StopWatch sw = new StopWatch();
- SoundFile grassCrunchFile;
- //CAT SPRITE Properties
- Sprite cat;
- //SoundFile cheetahFile;
- SoundFile catSoundFile;
- float catXpos;
- float catYpos;
- //Blue Bird SPRITE Properties
- Sprite BBird;
- SoundFile birdSoundFile;
- //Cute Bunny Properties
- Sprite cuteBunny;
- SoundFile bunnySoundFile;
- //Pinky SPRITE properties
- Sprite pinky;
- SoundFile pinkySoundFile;
- //fair warning when you listen to the sounds with headphones,
- //they don't sound right
- void setup() {
- size(1024, 512);
- FirstbackG = loadImage("forest.png");
- //
- //Cheetah Properties
- catXpos = 500;
- catYpos = 300;
- catSoundFile = new SoundFile(this, "catsound.wav");
- cat = new Sprite(this, "cat.png", 2, 4, 0);
- scale(0.1);
- cat.setXY(catXpos, catYpos);
- cat.setVelXY(0.0f, 0);
- cat.setFrameSequence(0, 15, 0.1);
- //
- //Blue Bird Properties
- BBird = new Sprite(this, "tropic Bird.png", 3, 3, 0);
- BBird.setXY(300, 100);
- BBird.setVelXY(0.0f, 0);
- BBird.setFrameSequence(0, 15, 0.1);
- birdSoundFile = new SoundFile(this, "birdsound.wav");
- //
- //Cute Bunny Properties
- cuteBunny = new Sprite (this, "bunny-Sheet.png", 4, 6, 0);
- cuteBunny.setXY(200, 390);
- cuteBunny.setVelXY(0.0f, 0);
- cuteBunny.setFrameSequence(0, 15, 0.1);
- bunnySoundFile = new SoundFile(this, "bunnySound.wav");
- //
- //Pinky Properties
- pinky = new Sprite (this, "pinkyRun.png", 6, 1, 0);
- pinky.setXY (700, 390);
- pinky.setVelXY(0.0f, 0);
- pinky.setFrameSequence(0, 15, 0.1);
- pinkySoundFile = new SoundFile(this, "pinkySound.wav");
- //
- registerMethod ("pre", this);
- }
- public void pre() {
- float elapsedTime = (float)sw.getElapsedTime();
- S4P.updateSprites(elapsedTime);
- }
- void draw() {
- background(FirstbackG);
- S4P.drawSprites();
- grassCrunchFile = new SoundFile(this, "grassCrunch.wav");
- //grassCrunchFile.play(); Fix the sound
- //bird
- if (keyPressed) {
- if (key == 'b') {
- birdSoundFile.play();
- BBird.setVelXY(35.0f, 0);
- } else {
- BBird.setVelXY(0.0f, 0);
- }
- }
- ////bunny
- if (keyPressed) {
- if (key == 'r') {
- bunnySoundFile.play();
- cuteBunny.setVelXY(-30.0f, 0);
- } else {
- cuteBunny.setVelXY(0.0f, 0);
- }
- }
- //Cheetah is activated when 'C" pressed
- if (keyPressed) {
- if (key == 'c') {
- catSoundFile.play();
- cat.setVelXY(30.0f, 0);
- //break;
- //if (catXpos >- width)
- // catXpos = 10
- }
- } //else {
- //cat.setVelXY(0.0f, 0);
- //}
- if (keyPressed) {
- if (key == 'p') {
- pinky.setVelXY(30.f, 0);
- pinkySoundFile.play();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement