Constrain value between two points
Fajlajp
Member Posts: 666
I´m stuck with a thing in my game that starts to get really annoying.
Here is a picture of my slider(it´s not a volume slider)
The slider should be like in the game "governor of poker where you slide a little thing to determine how much you want to bet/raise
I´ve constrained it so it doesn´t go to far but I´ve the problem of constraining it to a value. I want the value to be between to values. We can call them moneyMax and moneyMin. But I can´t get it to constrain between does to vaule when I slide determine on how far the slider is to the right.
Hope this not was a bad explanation and I hope that you understand what I mean.
Please help me.
Here is a picture of my slider(it´s not a volume slider)
The slider should be like in the game "governor of poker where you slide a little thing to determine how much you want to bet/raise
I´ve constrained it so it doesn´t go to far but I´ve the problem of constraining it to a value. I want the value to be between to values. We can call them moneyMax and moneyMin. But I can´t get it to constrain between does to vaule when I slide determine on how far the slider is to the right.
Hope this not was a bad explanation and I hope that you understand what I mean.
Please help me.
Comments
I don't know your values and how to do this exactly but you have to do something with the self.position.x from the money thing something like constrain game.moneyBet to self.position.x/4? so when position is 200 the bet is 50 and when position is 1000 bet is 250?
but probably you have to do something with the code
hope this makes sense
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
That's why I've two to values called moneyMin and moneyMax.
didn't tried so not sure if it will work...
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
When pressed
-- Constrain Attribute: self.Position.X To: max( game.sliderMin ,min( game.sliderMax , game.Mouse.Position.X ))
-- Constrain Attribute: game.betAmount To:300*( self.Position.X /( game.sliderMax - game.sliderMin ))
Yes,I noticed the skull
It seems to be a really hard thing to solve. So I thought I should explain better so more understand.
I´m try to making a bet/raise slide bar like in the game "governor of poker" and it basiclly a slider that has a minimum value and a max value.
I´ve set the bar to slide like this:
-- Constrain Attribute: self.Position.X To: max( game.sliderMin ,min( game.sliderMax , game.Mouse.Position.X )
The sliderMin is 575 and the sliderMax is 875 so it´s 300 between those points. Now I want to constrain a value called BetAmount between those two points and the miniumum value should be moneyMin and moneyMax.
moneyMin and moneyMax could change depending the minimum you have to bet and max is how much money you have.
Do you guys understand what I mean?
@socks
@fryingbaconstudios
@rthurman
@gyroscope
@jonmulcahy
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
It´s not always you have 300 and it´s not always you have to bet a minimum of 0. So it´s right but wrong.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
sliderValue changes from 0 to 300. It could be replaced by slider.position.x-sliderMin.
It worked Thanks
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS