1

i'm creating a game where a slider will have a countdown. If the time is finished, the player lost a life. If he hit the button in a specific point of the slider, he receive a bonus point. I manage to create the slider, the timer, and the hotspot being showed in a random.rage(), but how i can keep track if the user is sucessfull in the atempt?

I tried follow the hotspot position in y and comparing with the slider value in the time of the click, but the max value of the slide will keep changing, so i don't think this is the best solution.

enter image description here

The idea is: if the user press the button when the red part is right in the white part (gui will be added later) he gain a bonus.

Here a video of the game: https://youtu.be/sttWSFXBrj8

3
  • I like the 'dinder muffin' screen :). Anyway, I'm not entirely sure what you're asking. Do you want to validate that the user clicks on the white area of the slider? Why can't you take the logic that redraws the white and use that to check if the mouse click is in the same area?
    – Rob
    Commented Apr 29, 2016 at 4:20
  • Rob, the game is mobile. I shot a video here so it's better to understand the problem: youtu.be/sttWSFXBrj8 The resume is: if the user hits the slider in the bonus spot, he gains more points. Commented Apr 29, 2016 at 4:31
  • 1
    Well - that makes sense with the video. However, I think the conclusion is the same: Look at the logic which draws the level in the vial (the red), and the logic that draws the white block. If, at the time of a user click, the values overlap, you can apply the bonus. Alternatively, while filling the vial, you could set a flag if it's within the white block or not. There's a variety of ways, but we probably need to see some code before giving a definite answer
    – Rob
    Commented Apr 29, 2016 at 4:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.