# Creating a game

**URL:** https://discourse.processing.org/t/creating-a-game/2948
**Category:** Coding Questions
**Created:** [August 25, 2018, 3:26pm UTC](https://discourse.processing.org/t/creating-a-game/2948 "2018-08-25T15:26:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![suptoabha](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@suptoabha](https://discourse.processing.org/u/suptoabha)
#### Post date: [August 25, 2018, 3:26pm UTC](https://discourse.processing.org/t/creating-a-game/2948/1 "2018-08-25T15:26:23Z")

</div>

I need some examples of codes of games. So that i can get an idea how to make a simple game like a character can collect coin and increase score And if touch any object like bomb its life will be deducted. Just some examples if you have any or from the internet. It will be a great help. i have written some code

```auto
int x;
int y=226;
boolean play = true;

void setup() {
  size(800, 400);
  background(0);

  
}

void draw() {
  cave();
  stone();
  clumsy();
  bomb();
  
  
}

void cave() {
  noStroke();
  fill(160);
  rect(0,88,width,200);
}

void stone() {
  color c[] = new color[3];
  int n=0;
  c[0]=color(255, 0, 0); // first color
  c[1]=color(0, 255, 0); // second
  c[2]=color(0, 0, 255); // third
  for(int i=-2; i<width; i+=30){
    strokeWeight(2);
    stroke(0);
    fill(c[n]);
    rect(i,88,30,30);
    rect(i,285,30,30);
    n++;
    if(n>2) n=0;
  }
}

void clumsy(){
  strokeWeight(1.5);
  fill(0);
  ellipse(x+30,y-5,80,45);
  fill(#F3F156);
  rect(x,y,58,58);
  fill(#90F614);
  rect(x+40,y+10,10,10);
  fill(#EF1A1A);
  rect(x+15,y+30,25,15);
  if (play){
    x++;
  }
  if(x>width){
  x=0;}

}

void keyPressed() {
  
  if (key == CODED) {
    if (keyCode == UP) {
      if (y == 226){
      y-= 100;
      }
    }
  }
   if (keyCode == DOWN) {
      if (y == 126){
      y+= 100;
      }
    }
    
    if (keyCode == ' ') {
      play = !play;
    }
  }

void bomb(){
  

}

```

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [August 25, 2018, 4:07pm UTC](https://discourse.processing.org/t/creating-a-game/2948/2 "2018-08-25T16:07:09Z")

</div>

You can do a search for `game` in the forum and you can see some demos in the forum. I bet you can get some more hits if you do a google search like “games in processing”. If you are looking for a game, suggestions: moonlander, pacman, asteroids.

Kf

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [August 25, 2018, 6:23pm UTC](https://discourse.processing.org/t/creating-a-game/2948/3 "2018-08-25T18:23:40Z")

</div>

> [@suptoabha](#):
>
> … a simple game like a character can collect coin and increase score…

How about collecting sticks? 🥢  
[Studio.ProcessingTogether.com/sp/pad/export/ro.9bTfM49wCIJza](http://Studio.ProcessingTogether.com/sp/pad/export/ro.9bTfM49wCIJza)

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [August 25, 2018, 7:05pm UTC](https://discourse.processing.org/t/creating-a-game/2948/4 "2018-08-25T19:05:04Z")

</div>

Sticks are for chumps. It’s all about catching monkeys in nets these days.

[http://www.tfguy44.com/games/](http://www.tfguy44.com/games/)

---

<div class="post-metadata">

### Author: ![colin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/colin/32/230_2.png) [@colin](https://discourse.processing.org/u/colin)
#### Post date: [August 25, 2018, 10:18pm UTC](https://discourse.processing.org/t/creating-a-game/2948/5 "2018-08-25T22:18:57Z")

</div>

I did those open sourced things that may interest you 🙂  
[http://captainlee.org/](http://captainlee.org/)

> **[Non Idiomatic Jam Party by Martian's Parlor Entertainment](https://martiansparlor.itch.io/non-idiomatic-jam-party)**
>
> Live a co-op noise jam experience

  

> **[A Selfish Child by Martian's Parlor Entertainment](https://martiansparlor.itch.io/a-selfish-child)**
>
> A short story about putting yourself together

  

> **[191° by Martian's Parlor Entertainment](https://martiansparlor.itch.io/191)**
>
> Driving involves risks, sensations and dependency

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [August 26, 2018, 4:04pm UTC](https://discourse.processing.org/t/creating-a-game/2948/6 "2018-08-26T16:04:14Z")

</div>

Old forum section share your work

E.g.

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/27937/starbreak-game#latest)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.
