AndyObtiva / glimmer-dsl-libui

Glimmer DSL for LibUI - Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library - The Quickest Way From Zero To GUI - If You Liked Shoes, You'll Love Glimmer! - No need to pre-install any prerequisites. Just install the gem and have platform-independent GUI that just works on Mac, Windows, and Linux.
MIT License
497 stars 15 forks source link

examples/snake2.rb - three suggestions #15

Closed rubyFeedback closed 2 years ago

rubyFeedback commented 2 years ago

Hey there Andy,

I tested the snake2.rb variant :D

https://i.imgur.com/Pmdouqa.png

I noticed one tiny glitch or possibility for improvement I think: when the green snake hits the apple, there is a slight delay before it grows. I assume there is some internal re-calculation or something, so perhaps it can not be fixed, but I wanted to mention it. It's no big deal but a bit distracting.

The second thing: could perhaps a default keybinding be added, also as example, that when you hit the space key, the snake does not move? I don't know if that is possible but it would be nice to "freeze" it if that is possible via the space key, and then "unfree" it

last but not least, would it be possible to add entry fields, perhaps in the menu or something, to choose a specific colour? This also for demo purposes, e. g. say, a blue snake, and a pink apple or something. E. g. to allow the user to pick this thing. (I have not tested this in other snake variants such as glimmer-tk or so, so perhaps you don't want to add this to all snake variants, but I just added it here because I tested it right now in glimmer-dsl-libui)

AndyObtiva commented 2 years ago

No, yes, no.

Regarding your first inquiry, the delay that happens during growth is normal. That is because the snake does not really move when it eats an apple. It instead grows to cover one extra block, so it seems paused until it moves to the next block after the apple. I even checked an old Nokia Snake Version 1 online to verify that and it behaved exactly the same way.

Regarding your second inquiry, I addressed it by adding pause functionality in glimmer-dsl-libui version 0.4.21 by hitting the spacebar.

Regarding your third inquiry, it is unimportant and if a software engineer would really like to change the color, they can simply do so in the code with one or two word changes. The snake example is after all a learning demo, so we should leave some things to software engineers to do on their own too for learning purposes.

Thank you for your inquiries in any case. Keep them coming!