We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

HTML Puzzle get event property – tapping same key twice as function/input?

Home Forums Graphics / Blender HTML Puzzle get event property – tapping same key twice as function/input?

Viewing 15 posts - 1 through 15 (of 23 total)
• Author
Posts
• #66448
c4cc
Participant

If I can’t apply math to boolean (true or false), then how do I ensure puzzles for get event property or dictionaries recognizes 2 rapid key taps simultaneously as one special input for a specific effect or function?

I’m basically trying to turn an object group around 180 degrees by double tapping two directional keys. (e.g, double tapping key a to turn 180 degrees back, and double tapping key d to turn 180 degrees forward again)

• This topic was modified 12 months ago by c4cc.
• This topic was modified 11 months, 3 weeks ago by c4cc.
#67034
c4cc
Participant

Sadly, boolean is applied to time too, meaning, I cannot apply math to boolean for the time puzzles as well

• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
#67136
xeon
Customer

you dont have to use boolean true false for a state or flag.
You can set a variable to 0 or 1 or any values you want.

Your logic will have to determine if the keys were pressed consecutively in a time interval of your choice.

Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com

#67144
c4cc
Participant

Credit to kdv here for answering my original question regarding basic character movement: https://www.soft8soft.com/wp-content/uploads/2023/09/2023-09-20_21-14-27.png

you dont have to use boolean true false for a state or flag.
You can set a variable to 0 or 1 or any values you want.

Your logic will have to determine if the keys were pressed consecutively in a time interval of your choice.

That said, here is my answer to your question. For some reason, it does not work:

nor this:

So how do I fix these puzzles?

#67146
c4cc
Participant

This does not work either:

#67152
kdv
Participant

So how do I fix these puzzles?

Get rid of them and try to unsee them…

Math and logic to calculate the time between two consecutive key hits look in a little different way.

Puzzles and JS coding. Fast and expensive.

If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

#67166
c4cc
Participant

Thanks, I did try, but no change, sadly. I’m trying to get this character to turn smoothly 180 degrees back:

• This reply was modified 11 months, 3 weeks ago by c4cc.
#67168
kdv
Participant

As usual, you’ve taken a workin’ code and broken it with your unique vision of JS coding…

The key code “a*2” doesn’t exist in this universe. Use “KeyA”, KeyD”, “KeyW” and “KeyS”.

You can read any key value in the console log using this simple set of puzzles

Puzzles and JS coding. Fast and expensive.

If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

#67174
c4cc
Participant

Sorry, I couldn’t find that keyCode event, in the get event property

• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
#67175
c4cc
Participant
• This reply was modified 11 months, 3 weeks ago by c4cc.
#67177
c4cc
Participant

Get rid of them and try to unsee them…

Math and logic to calculate the time between two consecutive key hits look in a little different way.

Sadly that character still teleports 360 degrees, instead of smoothly rotating backwards 180 degrees. Also, after that smooth 180 rotation I’d like my character to stay facing that direction until double taps on opposite direction key (key D in this case) makes it spin 180 again.

• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
#67192
kdv
Participant

Sorry, I couldn’t find that keyCode event

Have no idea why.

And you don’t need it. `key` or `code` are enough. `code` is preferred, its value doesn’t depend on Shift as in case with `key`.

adly that character still teleports 360 degrees

Actually, 720 degrees. Or, in fact, it returns to its initial rotation.

instead of smoothly rotating backwards 180 degrees.

Where do you see a smooth rotation in your puzzles? I see three instant turns with an interval of 1 sec. You got exactly what you did.

until double taps on opposite direction key (key D in this case)

Create a similar set of puzzles to detect “D” being double-tapped.

Puzzles and JS coding. Fast and expensive.

If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

#67206
c4cc
Participant

Where do you see a smooth rotation in your puzzles? I see three instant turns with an interval of 1 sec. You got exactly what you did.

To get that smooth 180 degrees rotation within 2 seconds simply by tapping a key twice, besides time and objects puzzle (change objects rotation), do I use logic puzzles too? If so, how do I ensure the 180 degrees rotation is smooth, and not abrupt appearances?

Something like this, but key double tapped within 2-3 seconds as a specific input, for a 180 degree rotation within 2-3 seconds? Putting in the constraints another issue.

• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
#67212
kdv
Participant

how do I ensure the 180 degrees rotation is smooth?

Use `animate param`
https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#animate_param

Puzzles and JS coding. Fast and expensive.

If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

#67216
c4cc
Participant

Use `animate param`
https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#animate_param

While this is helpful, how do I get the object (group) to rotate at any desired speed at a desired angle (180 degrees here) consistently without being off angle?

When I put 180 degrees in z, under change, the object group spun around at insane speeds before finally changing directions accurately. When I put 1 degree in z, the spinning was at slower, but off angle.

Also, I’d like the spinning objects to face the player, not away.

• This reply was modified 11 months, 3 weeks ago by c4cc.
• This reply was modified 11 months, 3 weeks ago by c4cc.
Viewing 15 posts - 1 through 15 (of 23 total)
• You must be logged in to reply to this topic.