Laser Pinball

http://meatfighter.com/java4k2012/laserpinball/

Above is Video Pinball for the Atari 2600. I wanted to code a port of it, but the project morphed into something more interesting.

Really nice pinnball sim. I like the halo-effect.
And big thanks for the clean sourcecode.

PS: please remap the “quote” key and use “L” for example, as not everyone has the US-english keyboard-layout.

[quote]PS: please remap the “quote” key and use “L” for example, as not everyone has the US-english keyboard-layout.
[/quote]
Where’s Quote on your keyboard?

Swedish and German keyboards have the quote at “shift-2” for example.

The L is pretty much the same on all keyboards.

[quote]Swedish and German keyboards have the quote at “shift-2” for example.
[/quote]
I think that’s double quotation mark, not single quotation mark, the one that also works as apostrophe.

anyway, I can only press the key while pressing shift,
or you could also use the cursorkeys as second alternative.
(I usually -try to- use several alternative keymappings in games, for left and righthanders, so everyone is happy)

O___O HOW IN THE WORLD DO YOU FIT COOL GRAPHICS AND PHYSICS IN 4K!?! Zeroone you must be some kind of wizard.

Great game and great job, I got to 6,390,000 points :smiley:

EDIT: The a.class file is 22.5KB O_o
EDIT2: Also how did you create that glow around the walls using Java2D?

Nice gfx!
He’s not wizard, but Chuck Norris.
Please answer ra4king’s question number 2~

Fantastic! I managed 25,520,000 points…

I think ‘genius’ is the word you’re looking for :slight_smile:

I believe he/she renders the same shape in a loop, decreasing shape size while increasing alpha for each iteration. Here is a pertinent example from the source code:


    // create ball sprite
    g = imageGraphics[IMAGE_BALL];
    for(j = 63; j >= 0; j--) {
      g.setColor(j == 0 ? Color.WHITE : new Color(255, 0, 0, (63 - j) >> 3));
      g.fillOval(65 - j, 65 - j, 39 + (j << 1), 39 + (j << 1));
    }

Awesome! I love the graphics!

The choice of a and is rather unfortunate, because depending on your localization the ’ will trigger only 1 keyPressed event (it will ‘wait’ for another character, to combine them into á,é,ó etc etc)

Very impressive ! This pinball doesn’t feel at all like if it was made in just 4 Kb.

However, I have to complain about controls, as I was not able to find the key for the right flipper on my AZERTY keyboard…

It would be MUCH easier to change this to the left shift and right shift by using VK_SHIFT and then keyEvent.getKeyLocation() == KEY_LOCATION_LEFT or RIGHT

Add danish and norweigan ones.

This is happening here. In ABNT2 (Brazilian keyboard) it waits for another character…

Anyway this is just a very simple change. I agree that using SHIFTs are the best option for pinball games.

zeroone and kevglass are the best 4k coders!!! And the best is that they share their source code! At least we can try to learn from it.

Many apologies to all for the bad choice of keys. Originally, I provided several alternative key mappings. But, I was running low on bytes and many features were dropped.

The left and right shift keys would normally be my top choice, but under Windows if you press Shift 5 times in a row it enables StickyKeys. The arrow keys and WASD/ZQSD are not good options either because I want to involve both hands as you would with a real pinball machine. A and L are problematic on AZERTY keyboards since the keys are on different rows.

I would appreciate further suggestions before I change the mapping. Thanks ahead of time to all.

Congrats on the high score, but dapy destroyed you with more than 25 million points.

I put the uncompressed class file onto my web page to avoid pack200 issues. The gz file is currently 2 bytes under the 4K limit.

As described correctly by ra4king, it is generated by a loop that redraws the lines repeatedly with decreasing thickness and increasing color intensity.

Hehehe it was actually dapy that described the “glow” effect.

And now how about Left and Right Ctrl keys?

EDIT: Hehehe I played again and got 9,275,000 points. How many features are there in this game?! I suddenly got 2 balls rolling around, don’t remember exactly what I did for that to happen :S

Oops! You’re correct. Dapy’s the man. He currently has the high score and he knows his loopy glow effect.

On some reduced keyboards, there is only one Ctrl key and it may be found in a strange location. It is the same deal with Alt.

Collect all 5 white rollover targets to release extra balls onto the playfield.

Very nice game. I especially like the hard-to-get multi ball feature.

[quote]As described correctly by ra4king, it is generated by a loop that redraws the lines repeatedly with decreasing thickness and increasing color intensity.
[/quote]
it means to make a yellow more yellow? ???