Browsers, CTRL-W for moving forward in weighed down position - google-chrome

If You want to create a game.
And let your users use w-a-s-d as directions, why isn't it possible to CTRL-w be assigned then. every key is assignable except CTRL-W ? so you can't use w-a-s-d in the game or CTRL cannot be crawl.

Related

Keep track of when player enters/leaves a zone in game

I'm currently working on a UI based game where you have a "world map" containing a grid with zones (squares).
The zones are loaded through a json file coming from a database (MySQL) and are presented in a Grid Layout Group. Each zone has a zoneID in the database which is set in a local variable on the zone prefab.
When the player (you) are clicking on a zone, you will get a "Travel to"-button.
When the "Travel to" button is pressed, the idea is to "move" the player to that zone, coloring the image frame of the zone in yellow to highlight where you are. There is no actual player moving around, just UI and Text displaying the information.
My problem(s):
What would be a good and simple way to let the system know in which zone you are?
I'm thinking about a bool or something like (bool playerInZone), but how do I set it to true/false on other zones?
How do I reset the color when player leaves a zone and enters another? Currently I have no problem setting the color when pressing the button, but I can't seem to figure out how to reset the previous zone.
I can't seem to wrap my head around this...
I'm not sure if code is needed, I just need tips for how to think in this case.
Edit after understanding the question better:
I think I understand where your confusion comes from. You probably think that game-objects should manifest in the game view/physics in some way, where in fact many game-objects are just invisible units carrying game-logic related code.
I think a good solution would be to keep a manager game object that keeps track on the current location of the player. When you intercept a UI input that moves the player you'll do it through the manager, and the manager will be responsible to remove the highlighting from the current zone and apply it to the new zone.
It's probably a good idea to keep the "zones" as child objects of the said manager. Read about how to find game objects from parent game objects. I'm not sure which object intercepts the mouse click, but assuming that it's the zones themselves, than the manager can subscribe to events on the zones that will fire upon being clicked, or simply refactor to have a single object (perhaps the manager) handle the UI inputs.
Hope this is more helpful. Let me know if you need any clarification.
Previous comment
Use a collider trigger.
You can use the OnTriggerEnter and OnTriggerExit to set a bool whenever the player is in the zone. If you want coordination between different triggers and different zones you'll need a manager of some sort to handle this.

Flash CS3 (AS3) is giving my graphics (buttons and movieclips) outlines

So, I'm pretty much a beginner in Flash and Actionscript (using AS3, as I said in the title), and I'm trying to make a basic escape the room game. I haven't gotten far, and right now that's because every time I test my game (or publish preview it) the graphics get this annoying outline. Here it is when tested: http://i305.photobucket.com/albums/nn228/chokingondrama/flash.png
Every outline corresponds to some object present in the game, most of which have an alpha component of 0 since they're on different sides of the room. This didn't happen before, but once I added the code that allowed the player to change their view with the arrow (each viewpoint/wall is a different frame) these appeared.
It's a little different when published to HTML, basically it just gives each image a white background: http://i305.photobucket.com/albums/nn228/chokingondrama/html.png
Also, it would be nice if somebody could give me advice on how to make sure importing to flash won't result in lower quality.
Thanks in advance. If needed, I'll post any part of the code.
Some tips:
Don't set alpha to 0, instead use the visible property, setting movieclip.visible = false will make it a lot more efficient.
As for the importing and quality, after you import to stage or library, bring up the library (ctrl + l), and right click on the file you imported, go to properties. If it's an image, set compression to lossless, and allow smoothing.
For audio, go to file-> publish settings, and change audio stream and audio event (whichever you might use) to 128kbps.
As for your main question, I need more info, if you want you can post your source. It might be because of how you are placing your graphics on the stage.
For each of your MovieClips in question:
Try disabling button mode and see if the rectangles go away.
movieClipName.buttonMode = false;
If that doesn't help, or you really want button mode, try setting
movieClipName.tabEnabled = false;
There's a chance that since you added keyboard interaction each of your MovieClips are now expecting to be selected by the user when they press the tab key, much like any normal web form.
tabEnabled in the docs
You could also try
movieClipName.focusRect = false;
focusRect in the docs

Pressing space does weird things

I've made a simple game in flex. You control falling blocks and your goal is to eliminate viruses. It's almost a copy of the 90s game dr Mario. I've made it so you control blocks with the arrow keys and you spin the block with space. Everything works fine as it should when playing. However when i switch to another program and the application is out of focus and i get back to the game, whenever i press space the game restarts. It's like it calls a function that reinitializes the game and resets all the variables to the start values.
The game is made with several NavigationContent components that acts like scenes. The game doesn't go back to the start screen when i press space, it just resets the game. Wich is really weird.
Are there any default method that is called that causes this behavior? Anyone have a clue?
EDIT: The issue arises - as it seems - exclusively when i tie a function to the space key (keyCode 32). I solved the issue by rebinding the key to "CTRL". But still it would be great to know what's up with the SPACE key. The game works fine with space if i use Internet Explorer. Other browsers doesn't work with the space key. It's the same issue with all of them.
EDIT: This is how the event listener looks:
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, moveBlocksKeyboardEvent);
Even if i comment out all the code in the moveBlocksKeyboardEvent method the game still restarts. It's exclusively when hitting the SPACE-key. If i hold down the key the blocks spin. It's when i release the space button the game restarts. As if it's some reinitialization method tied to the KEY_UP event or something.
This type of behaviour is often tied to a null or undefined value, causing a nonsense-code jump which then results in a reset.
Make sure that that event handler for key down is attached to a valid object; if you are using "stage" then make sure it exists. When you move out of focus, the event handler may be left associated with a null object; when you reenter, it doesn't exist anymore, and therefore you get the reset behaviour.
This thread may help provide more detail:
Adding a key listener in Action Script 3

How To Use "Direct Input" Instead of Keyboard Events In ActionScript 3?

As you may know in "real" games you need to check if a key is pressed at this time. Right now I'm using events and I remember if last event was a key-up or key-down to know if a button is held down.
BUT I'm experiencing some lags (not network) in the game when several buttons are held down. New key pushes are recognized a little bit too late. From DirectInput in DirectX and from LWJGL I know how nice and smooth input for games can work.
a) So I ask: Is there a way to check keys directly in ActionScript 3 ? I don't think any other extra package would be useful since it would just do what I do right now.
b) If no. Why wouldn't Adobe add direct input feature to Flash since it is used for games to a high percentage ?!?

how to generate surround sound effect in html5

Here is the problem statement...
I am creating a scene using WebGL(THREE.js).
I have different objects around me creating different sounds.
Now I want to produce surround sound according to their position.
So if an object is at my right side, then sound from that object should come from right speaker and so on..
Is this possible in HTML5(any browser)
AlteredQualia did a test with that.
http://alteredqualia.com/three/examples/webgl_city.html (Chrome only)
Press m to disable the music, and n to enable the helicopter spatial sound.