Scroll field, change scene

Hello
I'm looking for a way to select a specific number in a scroll field (e.g. when selecting the year of birth). as soon as a certain number is chosen, a scene change should take place. I am not a programmer:(.

Many thanks for your help
Pascal

Well, if you're using Hype, you'll need programming to get that one done.

Are you using HTML inputs for the date? If so, then basically the logic is…

  • Whenever the input changes
  • get the new value
  • check if that value equals the number
  • Then, do something in Hype

Here are some links to help you become a programmer…

They both depend upon a JavaScript “input” event listener. More info about that here…

Basically, when the input changes, you then can tell the Hype project to do something with the Hype JavaScript API. That includes changing scenes…

hypeDocument.showSceneNamed("sceneName", hypeDocument.kSceneTransitionCrossfade, 1.1)

You'd just change “sceneName” to the name of the scene you want, and you can also change the way the scene changes with the additional options.

It's a little bit of coding, and that could tough to do at first, but if you can learn how to do it, then you should be able to do a lot more cool things with Hype.

Hello photics

Many thanks for your help. I'm trying to be a programmer, but that sounds pretty complicated... :/.
I need all of this for a game. You can scroll 20 values. But only one is correct. If you click on the right one, the new scene will appear.

I suppose you could do that all in Hype — if you don't need it to be dynamic.

If the correct answer (button) is pressed, go to scene. If not, play an error sound, or something like that.

That's exactly what I want! Scroll through numbers on a touch screen and then select the right number with a touch to then start the new scene. How can I do that?

That's just an action and lots of tedious work!

If you want to build something more dynamic, half of the puzzle is here…

…as it shows how to use buttons to change scenes.

There's also the “Capitals” template, which shows how to build a quiz…

The problem is that you want it scrollable. There are different ways to do that. You can use an HTML input for selecting a number. The “Pythagorean” template uses sliders.

You could also use the “on drag” to scroll a box… even a group. That's similar to this template…

…or you could use JavaScript to detect gestures and update your Hype project accordingly…

Basically, those are building blocks. Perhaps the web techniques used in those projects can be combined to create what you want to make.

You can use Hype Action Events

or

Thank you Photics
I bought the book! Then step by step further...

Thanks MaxZiep
This solution also sounds exciting. But how can I make it so that the name does not appear in the field, but hype changes to a new scene?

If its an age gate, you can do it even simpler…
Age Gate Example.hype.zip (31,0 KB)

2 Likes

Hello

Thanks very much. That's exactly what I was looking for! I have no idea about programming but have already learned something from JavaScript. Now I would like only one year to be correct. For example 18. If I delete the > from the script and only the = stands, unfortunately, it doesn't work. "Next Scene" always comes up. What am I doing wrong?

3 Likes

Thanks a lot, Max!

1 Like