Midterm Project Progress

For our midterm project, we were tasked with making a game on Processing, so I started by making a sketch of the layout for my game, and I wrote down a simple explanation about the game.

Idea:
Basically, the player will move a sprite around the screen with the arrow keys and collects the green circles, each worth 1 point. Alternatively, the player must avoid the pink ones. If you collide with a pink circle, you will lose 1 point. Get 10 points to win the game!

Here is my sketch of the layout-

Process:
So, my current plan is to make booleans so that I can switch between the different pages. And I think I’ll have to make 2 classes: one for the pink circles and one for the green. As for the point counter, I still haven’t figured out how to implement that.

Progress:
And so far, my sprite is moving with the arrow keys on screen, and I haven’t had time to start making separate pages, I will work on it over the weekend.

Sprite Code:
PImage linksprite , bg ; // all of the images 
PImage[][] sprites;
int direction = 1;
int step = 0;
int x;
int y;
int speed = 3;
int mode;
boolean start; // for the start screen 
boolean play; // game screen
int pts; // points in game


void setup() {
  size (1000,700);
//bg = loadImage("bg");
  
 // start = true; 
  
  //if (start == false){
  linksprite = loadImage("linksprite.png");
  sprites = new PImage[4][10]; // 12 images across, 4 down, in the spritesheet

  int w = linksprite.width/10;
  int h = linksprite.height/4;

  for (int y=0; y < 4; y++) {
    for (int x=0; x< 10; x++) {
      sprites[y][x] = linksprite.get(x*w, y*h, w, h);
    }
  }
 
//}
  x = width/2;
  y = height/2;
  
  imageMode(CENTER);
}

void draw() {
  background(255);
  //if (start == true){
  //background(bg);
 
  //}
  
  
  //look at sprite sheet to determine which direction is which
  if (keyPressed) {
    
    //if (keyCode == ){
    
    
    //}
    
    
    if (keyCode == DOWN) {
      direction = 0;
      y+=speed;
    }
    if (keyCode == LEFT) {
      direction = 1;
      x-=speed;
    }
    if (keyCode == RIGHT) {
      direction = 3;
      x+=speed;
    }
    if (keyCode == UP) {
      direction = 2;
      y-=speed;
    }
    if (frameCount%speed==0) { //the % is a modulo - its an easy way to make a loop 
      step = (step+1) % 10;
    }
  }

  image(sprites[direction][step], x, y);
  

}

 

One thought on “Midterm Project Progress”

  1. Hi Toomie,

    It’s hard to tell what’s going on here without any video or images. It looks like you found another spritesheet that’s good. But bhat is the theme of your game? Why is the player collecting the green circles and avoiding the pink ones? Can you think of a story that you could apply to the same game mechanics? Then you could use relevant images instead of green and pink circles.

    To keep track of the score, everytime the player collects something, or gets hit by something, you would either increase or decrease your pts variable.

Leave a Reply