# Need help for a simple game

**URL:** <https://discourse.processing.org/t/need-help-for-a-simple-game/17128>\
**Category:** Project Guidance\
**Created:** [January 17, 2020, 3:33am UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128 "2020-01-17T03:33:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![floflopm](https://avatars.discourse-cdn.com/v4/letter/f/779978/32.png) [@floflopm](https://discourse.processing.org/u/floflopm)\
**Post date:** [January 17, 2020, 3:33am UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/1 "2020-01-17T03:33:32Z")

</div>

Hi,

I am an architecture student and I need to develop a simple game for a project, but I never coded. Here is what I need to do (in Java):

-I want three shapes of different color blue-yellow-red to move in the screen in a ‘‘DVD player’’ fashion.  
-there are three behaviours that are each assigned to a color:  
1)scale up/down;  
2)shake more/less;  
3)multiply/divide  
-when the mouse touches a shape, the shape’s behavior is diminished (ex it scales down or shakes less) BUT it also amplifies the behaviour of another shape (ex a shape of another color is multiplied)

-when the mouse is clicked, the behaviors switch and are assigned to another color.

If somebody has an idea on how to write this it would save my life; I am currently trying to understand how to create classes of objects but I am a bit lost.

Thank you very much!

A newbie

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 17, 2020, 4:04am UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/2 "2020-01-17T04:04:21Z")

</div>

even we would like to save lives,  
we can not / are not allowed to / do your home work.

* * *

but we can help.  
please post your class code and your specific question  
( possibly reduced to ONE point to work on first )

the code must be formatted! in PDE and here for posting.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [January 19, 2020, 8:43am UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/3 "2020-01-19T08:43:21Z")

</div>

Hello,

> [@floflopm](#):
>
> I am currently trying to understand how to create classes of objects but I am a bit lost.

[Goggle search for classes+processing](https://www.google.com/search?q=classes+processing&rlz=1C1CHBF_enCA822CA822&oq=classes+processing&aqs=chrome..69i57j69i60l3.3134j0j8&sourceid=chrome&ie=UTF-8)

A lot of good links there to get you started.

🙂

---

<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:** [January 19, 2020, 10:57am UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/4 "2020-01-19T10:57:31Z")

</div>

> [@floflopm](#):
>
> move in the screen in a ‘‘DVD player’’ fashion.

Not understandable what you mean

Are you talking about buttons like play and stop buttons?

---

<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:** [January 19, 2020, 11:02am UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/5 "2020-01-19T11:02:47Z")

</div>

See also

[https://processing.org/tutorials/objects/](https://processing.org/tutorials/objects/)

---

<div class="post-metadata">

**Author:** ![Nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nathan](https://discourse.processing.org/u/Nathan)\
**Post date:** [January 19, 2020, 8:10pm UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/6 "2020-01-19T20:10:41Z")

</div>

Drawing colored shapes is quite easy to do with Processing and generating a random number, which is fairly easy in Java and most mainstream languages, will help you to select a different shape from some collection of them. You are going to need to track the state of a particular shape though across the whole of the time the program runs, something which objects will help with.

---

<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:** [January 19, 2020, 8:37pm UTC](https://discourse.processing.org/t/need-help-for-a-simple-game/17128/7 "2020-01-19T20:37:42Z")

</div>

For storing different kind of objects in an Arraylist see

> [@How to make a game with many different objects (ArrayList)](https://discourse.processing.org/t/how-to-make-a-game-with-many-different-objects-arraylist/16839/6):
>
> here is an example using interface and implements // demo for interface and implements // Interface allows to bring different kinds of objects in one ArrayList ArrayList\<BasicItem3D\> list = new ArrayList(); void setup() { size(950, 650, P3D); for (int x=0; x\<7; x++) { for (int y=0; y\<7; y++) { if (random(100) \> 50) list.add(new ClassBox( 300.0+x\*74, 100.0+y\*74, random(-150, 150))); else list.add(new ClassSphere( 300.0+x\*74, 100.0+y\*74, random(-150, 150…
