Log In  

Cart #sliderbar-3 | 2022-01-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


I wanted my game to have a slider bar and tried to do it myself from scratch. I couldn't find any examples where someone had made something like this (I could also suck at googling) so I figured I'd post my rough version so that people could improve upon it if they wish.

The code is still a bit of a work in progress, but all the main functionality works quite well:

  • Color changes at set points to add some dynamism (points are roughly hard-coded into fifths)
  • Tick marks show you where the color changes (just a little flair to make it look prettier)
  • One variable is used to keep track of where to put the slider sprite on the X axis as well as how far to fill the bar (you can access this to modify stuff, for example)
  • Minimum and maximum values so the slider sprite stays locked inside the bar

I took some of the mouse code from here: https://www.lexaloffle.com/bbs/?tid=43344
I removed the parts about hovering on stuff as I didn't need that.

Let me know what you think! This is my first time posting something so I hope you like it and look forward to some constructive criticism

P#105793 2022-01-28 03:16 ( Edited 2022-01-28 04:58)

I like the color changes signifying intensity, @lambrainz.

Something you might have is to not just allow MOUSE input but keyboard. With mouse you could have the markers "snap" to when the pointer gets close enough to each of them.

P#105805 2022-01-28 05:35

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 18:28:07 | 0.037s | Q:15