News for hackers. Stuff that matters.

alexmwalker

Re:CSS3 Ping Pong, with scoring on Wednesday May 08, 2013 @05:35PM (#5677113)
I actually have a write-up 80% written.

I showed the demo to a work buddy yesterday and a few hours later it popped up on HN. The genie got out of the bottle a little early.

Re:CSS3 Ping Pong, with scoring on Wednesday May 08, 2013 @05:28PM (#5677075)
At the moment, no.

Right now, the truth is, the millisecond you serve, you've already lost. The only question is how how long it will take.

I originally built the thing just as an interesting animation, and one of the guys at work said 'Hey wouldn't it be cool if you could play it?' I laughed off the idea at the time, but later started to wonder if it was maybe possible. It's ended up more playable than I ever imagined -- that's not great play, but I doubted it would have any game play value.

I do have the inkling of a method I might be able to make the robot player defeatable. I'll mull it over for a while.

Re:CSS3 Ping Pong, with scoring on Wednesday May 08, 2013 @04:25AM (#5673131)
I don't think there's anything I can do about that -- short of using JavaScript, which kinda defeats the purpose.

Basically, every time you move the cursor, the browser checks to see if you triggered a new hover state. If you keep still it assumes nothing has changed.

In this demo it's the thing being 'hovered over' that's doing a lot of the moving -- but the browser doesn't ever check for that.

Maybe there's a better alternative to :hover? CSS is obviously a limited toolset when it comes to this kind of thing.

The challenge is there for anyone who wants to fork it ;)

Re:CSS3 Ping Pong, with scoring on Wednesday May 08, 2013 @04:07AM (#5673083)
Mainly because I'm trying to fake 'collision detection' by using CSS hover. You could almost describe it as more of a 'controlled animation' than a game.

CSS isn't designed for this kind of thing, so we have to work with what we have.

Re:CSS3 Ping Pong, with scoring on Wednesday May 08, 2013 @04:01AM (#5673073)
Hey guys.

Thanks for the feedback. It's very much a work-in-progress and I was surprised to find it here.

It's certainly 'Chrome-centric' at the moment -- but I don't think there's any reason it shouldn't eventually work in most modern browsers.

Taking the bat off the cursor when it's outside the court area is probably a smart move. Will do.