Inspiration:
The game is inspired by themes from “Nyan Cat: Lost in Space”, and the game style/mechanics are similar to Chrome’s dinosaur game. The main similarities with the dinosaur game is that it is controlled by one key and there is no win condition. The game continues to run until the player hits one of the death obstacles or moves off screen.
Midterm progress:
So far, I have collected the main images and sounds which I will be using. I also have a plan for the game mechanics, which I have yet to implement most of. The game consists of one character which can be controlled by the space bar. The character is always moving along the x values, gravitating towards the bottom of the screen, and bouncing between the two “walls” at each side of the screen. The goal of the player is to keep the character on screen else the game ends. Obstacles will include objects falling from the top and bubbles rising from the bottom. If a falling object hits the character, the character will gravitate faster to the bottom, and if a rising bubble collides with the character, the character will be paralyzed for a set amount of time and will continue to rise to the top of the screen. The score will be increasing as long as the game has not ended, and bonus object might appear to help the player increase their score.
Below is a visual of the game and a portion of the code.
PImage jazz_sheet; PImage[] jazz; Star[] stars; int starcnt; int step = 0; int x; int y; float speed = 3; float gravity = 0.5; int wall; void setup() { fullScreen(); wall = 80; starcnt = 80; stars = new Star[starcnt]; for (int i=0; i<starcnt; i++){ stars[i] = new Star(); } jazz_sheet = loadImage("jazz.png"); jazz = new PImage[12]; int w = jazz_sheet.width/12; for (int x=0; x<12; x++) { jazz[x] = jazz_sheet.get(x*w, 0, w, jazz_sheet.height); } x = width/2; y = height/2; imageMode(CENTER); } void draw() { background(0); if (keyPressed && keyCode==UP) { gravity -= 0.1; speed += 0.1; } else { gravity += 0.1; speed -= 0.1; } if (frameCount%6==0) { step = (step+1) % 12; } for (int i=0; i<starcnt; i++) { stars[i].display(); } pushMatrix(); if (speed>0) { image(jazz[step], x, y); } else { //scale(-1, ); image(jazz[step], x, y); } popMatrix(); pushMatrix(); rectMode(CORNERS); fill(52, 232, 221); rect(0, 0, wall, height); rect(width, 0, width-wall, height); popMatrix(); x+=speed; y+=gravity; if (x+100 >= width-wall) { speed *= -1; } } //void keyPressed() { // if (keyCode == 49) { // gravity -= 0.5; // speed += 1; // } else { // gravity += 0.5; // speed -= 1; // } //}
class Star { float x, y; float y_min, y_max; float diameter; float ty; float speed; Star() { diameter = 3; x = -diameter/2; x = random(0,width); y_min = 0; y_max = height; y = random(0,height); ty=random(0, 10000); //ty = 0.1; speed = random(0.1, 0.5); } void motion() { y += map(noise(ty), 0, 1, -1, 1); //y += noise(ty); x += speed; ty += 0.02; } void reposition() { if (x >= width+diameter/2) { x = -diameter/2; } } void display() { fill(255); motion(); noStroke(); ellipse(x, y, diameter, diameter); reposition(); } }
Hi Ziyad, I can’t tell what your game is about from your blog post here. It sounds like you have a good handle on what you need to do, but there is nothing indicating what the actual game is.
Hello Professor, I didn’t realize the description was unclear. The code was still underdeveloped, so I think I should have added a few more details. I have updated the post to include those details. Thank you.
Thanks for updating it Ziyad.