Physics and random scoring (Galton Box)

I have been working with Physics quite a bit with this beta and also curious on how Hype 3 could be used for simple to more complex games.
In one of the threads some folks have been trying to come up with a hit/test scoring script with some limited success. I have started looking at a more antiquated method of scoring based on the randomness of the element physics.

First test is based on a Galton Box or Bean machine where balls are routed using alternate rows of pins to change their direction.
This could be a way to create some random chance games with Hype and the physics element either with gravity on the positive (drop) side or negative (float) side.
If javascript could be applied to the collection bins that might add for a more interesting way to display scores as well.

Galton_Box.hype.zip (70.1 KB)

2 Likes

Good to see you again Nick. You could use jQuery’s ‘offset’ to get the position of a ball then do a few if statements to see if the ball lies within one of the scoring areas. You could use regular javascript too, but jQuery makes it a lot easier.

Here’s a sample of getting a balls offset (I reduced the number of balls to simplify it)
Galton_Box_Edit1.hype.zip (69.5 KB)

Greg, Thanks for this.
I think this has some possibilities. I noticed that since I have the balls turned up on their bounce and their friction it also effects their place in the offset over time.
If you click the button to test the offset over and over you can see how the ball moves a pixel every second and changes the outcome.
Tiny but a neat observation on how the Dynamic Physics interacts with the static physics elements.
I am going to do an update to the box this week and repost with some sliders to adjust physics on the balls as well.

Here’s a test with scoring for three balls. I still need to figure out a way to score two balls of the same color.

There is probably a much better way, but it’s fun learning :smiley:

Galton_Box_Edit3 copy.hype.zip (71.4 KB)

Hey Greg
Why do you write
all = (sc11)+(sc21)+(sc3*1)
Can’t
all = (sc1)+(sc2)+(sc3)
be enough ?

Oh, and there seem to be a problem
Here’s what shows the box when I click Button :

I tried as you suggested but it would just put the numbers in the box like 1 2 3 instead of 6, so I used the multiplier to get past that. You’ll get the NaN (Not a Number) error if you hit the button before the balls hit the bottom of the game area because I’m also checking the top offset of the balls.

Ok a new use for physics and quick digital toys.
This is a very simple all Hype feature little animated toy.
The characters have on Drag applied to them and physics.

  1. You drag a character to the top of the hill and drop him on the red dot.
  2. Click on the character to start the animation

Physics takes over the character as he sails off the hill.
The hill is overlaid with invisible shapes set to static physics to simulate the terrain.
If you adjust the friction and drag on the static and the dynamic elements you can get some nice effects.

After you have dragged all of the characters to the top and sent them sailing click the replay flag to start again.
Enjoy!
saucersled psychos.hype.zip (764.9 KB)

3 Likes

Challenge: with this topic it would be neat to extend the play for the “sledders”
avoid flapping birds or snowmen etc.

1 thing that I learned with this exercise is that if you adjust friction on both your invisible terrain pieces and your sprite you can get a great sliding surface.

adding controls in a game on screen to adjust the physics in game play will be fun and that can be accomplished by creating slider for the physics properties.

Also used web fonts in this one too.

Another interesting thing is that you can do quite a bit with Hype Drag actions and Physics without adding a lot of javascript. The jQuery makes things more interesting for sure, but a designer can get a lot done with this new version.
:smile:

2 Likes

That’s a fantastically fun document @nick! I love the screams :).

1 Like

All:

Thought I would share something that I found through a tweet.
Not Hype but Edge Animate.
This is a good example of a scoring mechanism.
I would be willing to pay extra for this as a quick function plug in for hype.
The rapid development of Hype based games would explode…positiviely of course :slight_smile:

1 Like

Same here @nick
missing a js-fuction (vanilla or jquery -based) for adding scoring mechanism to a Hype-based game!
In general, I’d love to see Hype’s getting an in-built library of handy js-snippets, with digestible how-tos for visual designers.

1 Like