The Pong example you linked was written for an older version of Elm
I have created a 0.17 version:
https://gist.github.com/pdamoc/fd29925b8e20dd92e91c5b75e6c3711e

As you can see there, the keyboard ups and downs are translated into
actions that update some player info structure with the direction selected.
The Tick message handling uses these structures to compute the next frame
of the game.

You can think about this approach as creating a keypress related model and
having the Tick message take a snapshot of that model and use it to drive
the game logic.

You can process the keypresses and update some kind of meaningful data.
I've updated the direction for both players.




On Thu, May 19, 2016 at 10:48 AM, Sönke Hahn <[email protected]> wrote:

> Hi Peter,
>
> thanks for your answer!
>
> On Monday, May 16, 2016 at 12:25:32 AM UTC+8, Peter Damoc wrote:
>>
>> Auto-repeat happens bellow the level controlled by Elm.
>>
>> https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Auto-repeat_handling
>>
>
> Yeah, that is what I suspected.
>
>
>> Why do you want to disable auto-repeat?
>> (This sounds very much like an XY Problem
>> <http://mywiki.wooledge.org/XyProblem>)
>>
>
> Yes, might very well be an XY Problem. :)
>
> So, what I *really* want to do is this: I want to toy around with a small
> game that would accelerate some object, while certain keys are being
> pressed. For as long as they are being pressed.
>
> I haven't looked at any game examples in elm -- and I really should, since
> this would probably answer my question. I'll read
> http://elm-lang.org/blog/making-pong -- although some links in there are
> dead.
>
> Cheers,
> Sönke
>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to