Points accumulation techniques? (Counting a score)

(davemez) #12

You guys are so smart i get a smile every time. Will certainly muddle my way through how you set this up and see if I can learn a few things. Thanks!

(davemez) #13

Oh well, thought i figured it out but I can’t seem to get it to work. I saw the script looked for class names ‘buffer’ to use observe and count/compare differences. And that the buffers individually had been itemized. So i tried to copy & paste, call the elements by the IDs and adjust the number of buffers in the class. Somehow I must have done something wrong, will keep trying. (pssst… Dave, learn some Java man!..) I’m much better at the visual artsNewYearsCardAlt.zip (3.9 MB) than talking in alien languages :smile:

(Greg) #14

Yeah, in Safari the Debugger says…

[Error] ReferenceError: Can’t find variable: jQuery
global code (e-smart-hittest-jquery.min.js, line 13)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (touch-icon-192x192.png, line 0)
[Error] TypeError: undefined is not a function (evaluating ‘$(’#observe-’ + observerID ).objectHitTest({“object”:$(’#buffer’ + i), “transparency”:true})’)
observerChanges (undefined, line 38)

So it looks like ya missed something somehow (maybe ;-))

Look to see if you missed one of the ‘#’ on one of the #buffer or #observe calls in the script.

(Greg) #15

I changed the width of both boxes to 50px, it looks like the font size was causing it.

(strmiska) #16

you can take attachment for collisions in hype - i work a lot using this version.
collision_badsyntax.hype.zip (49.2 KB)

(Hans-Gerd Claßen) #17

Keep in mind it’s buggy and doesn’t count really well. NewYearsCardAlt.hype.zip (3.8 MB)

Physic element triggering sound - car dashboard
(Hans-Gerd Claßen) #18

attach some physics to the elements and let them bounce …

I’ve tried with intervallsettings too then went to mutationevent. It’s better but not 100% though. there are always some collisions left out …

(Hans-Gerd Claßen) #19

New one, took DaveMez Soundeffects to play arround … :

(Greg) #20

Awesome Hans. Well done!

(davemez) #21

Nice! Job! I’ve got some diving in to do!

(Nick ) #22


Love this!
Hope you do not mind I dressed it up with the Bagatelle Artwork I did.
Feel free to use and change etc etc :smile:

One buggy thing…when adding drop shadows to transparent elements such as the flippers you get some odd background artifacts in the containing shape.

Over time I would hope a group will come together on game development, Understanding this aspect of Hype with the PhoneGap and Cordova bundling makes this application even more powerful.

test.hype.zip (584.3 KB)

(Nick ) #24

test-2.hype.zip (584.2 KB)

(Nick ) #25

Also Jonathan Deutsch made this launcher some time back I tried to add it to the mix but it canceled out some things in the work Hans did.
But this is a nice add for everyone. Pull back on the ball to launch it.

if(event['hypeGesturePhase'] == hypeDocument.kHypeGesturePhaseEnd) {
	hypeDocument.startTimelineNamed('Launch', hypeDocument.kDirectionForward)

bagatelle-with-launcher.hype.zip (338.2 KB)

Is there a Physics API? 🤔
(Nick ) #26

For the Frosty game check out the launcher on the 24th post of this thread.
It might make the snowballs have some zip to them :smile:

(Nick ) #27


What am I doing wrong here?
I wanted to apply the e-smart hittest to this pinball device.
I basically layer the images to create the illusion of a bucket where the ball can fall.
I changed the class id’s to match what seem to be the 3 key elements in the example.
The score mechanism which is a transparent rectangle behind the sore bucket_bottom
The ball and the score window.

Yet I am not recording any hits. ideas?
pinball_bucket.hype.zip (269.0 KB)

(Hans-Gerd Claßen) #28

pinball_bucket.hype.zip (217.6 KB)

few things where messed up :wink:

(Nick ) #29

Thanks for looking at this I knew I was not Getting the whole picture :slight_smile:


Nick Gressle Illustrations LLChttp://www.gressle.com/go

(Jonathan Deutsch) #30

This is a bit of a tricky one - Hype text boxes have two modes, one where they expand to fit the text and another using explicit dimensions. Text boxes are made to fit (so when you type in them they grow), but if you ever change the width, they’ll become explicit and always be that size.

In your case, the “Hits” is sized to fit, and the Count text box is explicit, as I assume you manually adjusted that size to fit. The Hits is then changing size in different browsers because the font rendering metrics are different (in fact, Hype will add a pixel extra to account for differences between retina/non-retina screen renderings. So I’d classify this as a bug, but the solution on our part isn’t so straight forward since we do want text fields to grow/shrink for rendering differences.

The workaround for you though is to just manually resize the Hits box and this will make sure it is in the explicit mode.

Beautiful candy cane paddles!

I’m so amazed by all the great physics-based experiments and documents, absolutely great stuff!

(Nick ) #31

Still struggling with this one.
When I try to copy into a new hype document it will not work.
I have been able to adjust the counter to count by 3000 etc but it seems to only work with the original document.
If I try to create a new document and rewrite everything I get the same result no hit count.
Would you be able to explain how the collision passes to the text field and is it only a Hype text filed or is it a n inner html field?


(Hans-Gerd Claßen) #32

Hi Nick,

  1. in your setup every ‘buffer’ has to have a unique ID ‘buffer1’, ‘buffer2’, … AND a class ‘buffer’
  2. ID for the ball = ‘ball’
  3. start the script on sceneload. it’ll start a mutationObserver which records the domchanges of the ‘ball’ in arrays. every arrayelement will contain a ‘outerHTML’ which represents a status of the ball at a given moment in the past -> not the actual status
  4. As we use ‘e-smart-hittest’ it can only check against a dom-object. so we create a new (static) element using the received ‘outerHTML’ (3.). Append it to the ‘ball’'s parent. Now we check this element against all buffers … finally remove it. And so on …

Textfield is any Element with given ID = ‘res’

As hype may change its setup (wrapping of elements) in the future, you’ve got to take care of this.

Nice day :smile: