≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Smooth Movement on Keyboard Input
Posted by:
(you are not logged in)
Enter the missing letter in: "Inter?ational"
(you are not logged in)
Text:
[quote][b][/b] wrote: Ok, I've found a way to do it. Here is the code for 3 keys : [code] var IsKeyLeftPressed = false; var IsKeyRightPressed = false; var IsKeyUpPressed = false; engine.OnAnimate = function() { if (IsKeyLeftPressed) {cam.Pos.X += 5;} if (IsKeyRightPressed) {cam.Pos.X -= 5;} if (IsKeyUpPressed) {cam.Pos.Y += 5;} } document. = function(event) { if (event.keyCode == 39) IsKeyRightPressed = false; if (event.keyCode == 37) IsKeyLeftPressed = false; if (event.keyCode == 38) IsKeyUpPressed = false; } document. = function(event) { if (event.keyCode == 39) IsKeyRightPressed = true; if (event.keyCode == 37) IsKeyLeftPressed = true; if (event.keyCode == 38) IsKeyUpPressed = true; }[/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact