code won't stay hidden

I’m trying to move the avatar and so I hide my code, but it reappears as soon as I press any key.

That’s super weird :confused:

I can kinda get this to happen if:

  • I hit the Tab key, which highlights the “Show Code” button
  • Then press the Enter key

But if I press any other key, then nothing happens.

Are you using the Google Chrome browser on Mac, Windows or Chromebook? Can you share your code? I can’t think of anyway that the code could be breaking 3DE like this, but maybe there’s something weird going on?

-Chris

I’m using Chrome Version 68.0.3440.106 (Official Build) (64-bit) on Windows 7 64-bit.

Here’s a link to my code.

Curiouser and curiouser. Your code looks great. I don’t see anything in there which might trigger the code to re-show. It works great for me with the WASD keys.

One thing you can try is adding the following line at the bottom of the sendKeyDown() function: event.stopImmediatePropagation() so that the function looks like:

function sendKeyDown(event){
  var code = event.code;
  // WASD movement
  if(code=="KeyA")marker.position.x = marker.position.x - 5;
  if(code=="KeyD")marker.position.x = marker.position.x + 5;
  if(code=="KeyW")marker.position.z = marker.position.z - 5;
  if(code=="KeyS")marker.position.z = marker.position.z + 5;
  // cartwheeling and flipping
  if(code=="KeyQ")isFlipping = !isFlipping;
  if(code=="KeyE")isCartwheeling = !isCartwheeling;
  event.stopImmediatePropagation();
}

That really shouldn’t help, but :man_shrugging:

Another possibility is that you have a Chrome extension installed that might be interacting strangely with 3DE. To test that out, you could choose New incognito window from the Chrome menu, then go to code3dgames.com/3de, and paste your code into the editor. If the keys work correctly there, then you likely have a Chrome extension installed that’s not playing nicely (event.stopImmediatePropagation() could also help with that).

I’ll have access to a Windows Surface tomorrow so I can try to reproduce then.

-Chris

“event.stopImmediatePropagation()” didn’t change anything but my code works fine in incognito mode, so it’s probably an extension like you said.
It’s weird this isn’t a problem with the ICE site you used for the 1st edition.

That really is strange. Not much has changed in the editor between the first and second editions. If it’s not too much trouble and you don’t mind, can you share the list of extensions that you have installed?

To list your active extensions, put this in the URL bar for Chrome: chrome://system and then click the Expand... button to the right of the “extensions” row. You can either paste the list here in the forum or send it to me at chris@code3dgames.com.

-Chris

For any others experiencing similar problems, we tracked this issue down to the Typio Form Recovery Chrome extension. Removing that or disabling it for www.code3dgames.com will fix the reported problem. We’ve added an issue tracker to investigate this further.

-Chris