Hype Exam please help me :(

Hello everyone, I’m a student of Graphic Design and it gives me little ad Hype only that we are practically learning on their own and I’m really struggling, I state my problem for you will be simple but I do not really know where to bang your head …

My animation consists of a minigame inherent to the feast of St. Patrick’s where a leprechaun by pressing the space bar correctly drinks and the goal is to drink more beers possible, the animation was not correct in the preview then I redid it but gives me the same problem but I can not understand why … I basically find myself in the sequence of the movement, all right while if I create another sequence I see all the elements stacked

And p.s regarding the code I’m not very good, what codes should I use for the function that I would like to play ??

Thanks a lot in advance and I have the exam on Wednesday, anyone who wants to help him I will be infinitely grateful
Leprecauno 2.zip (269.5 KB)

Ciao a tutti, sono uno studente di graphic design e ho scritto un topic poco fa del quale son riuscito a risolvere…

Volevo chiedere, data la mia poca capacità con il javascript…se qualcuno può aiutarmi nel mio minigioco…

Dovrei avere un codice che premendo la barra spaziatrice fa avviare la sequenza dove il mio personaggio beve, mentre se la si clicca per troppo tempo parte un’altra sequenza dove la bevanda si rovescia e si perde…qualcuno può aiutarmi perfavore?

473/5000
Hello everyone, I’m a graphic design student and I wrote a topic a little while ago that I managed to solve …

I wanted to ask, given my little ability with javascript…se someone can help me in my minigame …

I should have a code that by pressing the space bar starts the sequence where my character drinks, while if you click it for too long, another sequence starts where the drink is reversed and lost … can anyone help me please?Leprecauno.zip (388.4 KB)

Hello everyone, I’m a graphic design student and I wrote a topic a little while ago that I managed to solve …

I wanted to ask, given my little ability with javascript…se someone can help me in my minigame …

I should have a code that by pressing the space bar starts the sequence where my character drinks, while if you click it for too long, another sequence starts where the drink is reversed and lost … can anyone help me please?

Thank to everyone :slight_smile:Leprecauno.zip (388.4 KB)

Hi,

Please try and not double post. People will get to your question when and if they can…


In regards to space bar and Javascript…

This being for an exam it would seem to me that writing the code should be left to you but;

You could look at key down Actions in Hype Scene Inspector and use this to call a javascript function or run a Javascript on load that has a listener for keydown events.

You need to do some research. I suggest searching google for keydown events and how to detect a particular key is the one that fired the event. (event.keyCode) You could also look at how to know the duration of a keydown.

I apologize for my behavior, but our professor left us with no answers and I’m really desperate …
Thank you for the help … in case I can contact you if I can not solve it?

Hi, as well as double posting, it is very confusing if this is 1 or 2 people as the posts are identical. If this is 1 person with 2 accounts setup then please only use 1 account.

If this is 2 then, as Mark has suggested, please be a little patient when posting even though it’s desperate, you should get an answer quite quickly.

But, as Mark also mentions. This is for an exam and giving you the answer wouldn’t be right as you wouldn’t really learn.

That being said, here is some info that will help. Building on what Mark has said.

In Hype, there is an area for adding listeners for key press / key down

EB6294D6-1570-4AA7-99EE-D55C4563B351

When clicking the “plus” button you can choose to Run Javascript… > New Function…

and then call it what you want (above I’ve called it “myFunction” replacing the default “untitled”

Now to help you further look at the “event” by using the console.log function.

In your browser’s console you’ll be able to see what keys are being pressed. You can then use this information to play timelines or other things.

I really thank you for your help, and I apologize for my behavior again …
The factor is that Javascript has done very little at school and as a
self-taught I’m not a crab …

I knew that you could implement the Javascript the problem is that I would
not know where to start … I entered a code but I do not find feedback,
first because maybe I made the animation incorrectly maybe … or I’m the
one who I just can not …
I ask too much if I can send you the file to see if at least the animation
is correct?

I still apologize for the anxiety but I wanted to achieve something nice
for this exam but I think I have complicated myself …

I’ve already written a piece of code to try, but I do not think it exists
in this way

You need to run that code on Key Press / on Key Down then you will get the desired effect.

“event.keyCode” will only work on these listeners. It will not work on the others.

Also, as I mentioned above. You will see that the “event” contains a lot of information. One piece of information is the “event.timeStamp” which will give you the time in milliseconds which you could use to calculate the difference by collecting timestamps for the key down and key up and subtracting them to get a duration.