PWM (Pulse Width Modulation) 2D Game

Hello everyone !

No big deal, but here is my first “original” 2D game: PWM (Pulse Width Modulation)

Basically, the goal is to press or release the space key to generate square wave pulses (in blue) and keep the white small ball on the screen (representing the speaker diaphragm’s level) as close as possible to the yellow wave.

The ideia was based on this video

Implemented in java 8 using just standard libraries (java 2D, Swing, AWT), so no external libraries required.

Keyboard Controls:

[Space] key: move the ball up or down

Thanks :slight_smile: !

Link to download Runnable Jar [java 8]: (13.4KB)

Source code:




“Original” game this time :smiley: There is an interesting source of inspiration :smiley:

Well, it was hard, this is my best try:

Looks like everything works fine, by the way.

hello @SugarBlood, very nice score ! thanks for the kindness of always testing my games :slight_smile:

Any chance of:

a) fullscreen/resolution change
b) rebindable inputs (specifically, use a mouse button instead of keyboard key).

It’d make it a lot more tolerant of hardware variance. (and would eliminate a couple of excuses for me being so bad :point:)

@LeoOno, no problem, you’re welcome ;D This is not taking too much time :slight_smile:

[quote=Abuse]rebindable inputs (specifically, use a mouse button instead of keyboard key).
I don’t know about that, but different key instead of space, would be nice, like CTRL.

@SugarBlood, @Abuse, very nice suggestions !
as i was implementing only old games, i forgot that there is a mouse input xD …
i’ll see what i can do later, but now that you mentioned, i was doing some tests and i can’t get the full screen work work in linux :frowning:
well thanks for the feedback :slight_smile: