Tag Info

New answers tagged

0

You need to declare variables that will contain the played character's position. Decide if the game is 2d in nature or 3d. You need to do collisions an play a sound during a collision like any other game using tutorials to guide you. To compute the sounds intensity, define sound sources in the map and then compute the distance from them, the sound intensity ...


1

You use a library that handles those numbers: https://github.com/MikeMcl/big.js


0

Got it working full javascript below var game = { //game object level: 1, //current level turn: 0, //current turn difficulty: 1, // user difficulty score: 0, //current score active: false, //whether a turn is active or not handler: false, // whether the click and sound handlers are active shape: '.shape', // cached string for ...


0

I guess you want something like this: var givenTime=10000 var timeLimit var clockInterval resetClock() function updateClock(){ var now=new Date().getTime() if(now<timeLimit){ //Set the displayed clock to timeLimit-now } else{ //Time has run out clearInterval(clockInterval) } } function resetClock(){ ...


0

Javascript has the setInterval(function(), milliseconds) function which could help here. If you need to get rid of the interval once you're done with it you can store your interval like so, and then clear it: var timer = setInterval(tick, 1000); clearInterval(timer);


2

Try this: var speed = Math.sqrt(Math.pow(heroVelX, 2) + Math.pow(heroVelY, 2)); The case is that the ^ operator is the bitwise XOR operator. You should use Math.pow(base, exponent). Here is a an example: link.


1

Three.JS has a function for this based upon this principle. BTW Matrix4x4 are represented internally as Column-Major, not sure what bullet uses. Three.js Matrix4x4.makeRotationFromQuaternion(Quaternion) makeRotationFromQuaternion: function ( q ) { var te = this.elements; var x = q.x, y = q.y, z = q.z, w = q.w; var x2 = x + x, y2 = y + y, z2 ...


1

Support for this was added in Phaser 2.1.2. Please see the Text.addColor method.


0

The problem is most probably the window.setTimeout(callback, 1000 / 60); and then using (% 10 == 0). The window.setTimeout() callbacks are not "accurate". Thus, if you update your objects this causes the noticeable wobble. Also your timeout functions runtime is shorter or longer depending on "counter % 2 == 0" and "counter % 10 === 0" is true. So you should ...


3

You are not setting the Player transform of your clones, most likely. If I had to guess, you drag and drop the Player object onto your prefabs that are in your scene. This effectively maps your player onto your Transform object. However, if you clone the enemy, the object is a new instance, and the player transform is not initialized. Example on how to ...


0

How are you resolving these collisions? How does gravity or whatever work here? Your question doesn't really give us a whole lot to go one. It could be that the gravity is causing the player to sink into a tile, which is then resolved along the x axis, before the y. What I would do, is move on each axis separately. Move along the y axis , check, resolve. ...


1

Looking at your video it appears that the cloned EnemyL object has an EnemyL(Clone) as the value for the variable enemyl. I suggest ensuring that the EnemyL prefab has the EnemyL prefab as the value for its variable enemyl. Thanks for posting image below. It appears that you have the prefab "linked to itself" and when cloned at runtime these clones are ...


7

For a Chrome-based solution to make the game run offline and enjoy some native functionality, you can consider making a Chrome App. This way, you can distribute it in Chrome Web Store for added visibility, you can enjoy some powerful APIs, and make it look more like a standalone app. The downside is, of course, requiring Chrome.


2

If you want to change a Material in Unity you have to retrieve it first. If your GameObject uses a Material it means that it uses a Renderer. You can retrieve your object renderer using the internal variable renderer or get it using the GetComponent function. On the renderer object you will find a material property containing the active Material. For ...


2

Look at PlayerPrefs class. It's a key/value system that allows you to save, or read, a value.


20

You can embed images in the HTML document using the dataurl-syntax which allows to put the base64 representation of the binary image data as the src-attribute of an image. This also works on any other kind of media file. <img ...


29

Just putting all the files into a .zip file isn't a viable solution because most web-applications need a web-server so that they can access resources via HTTP-requests. On some systems you can access files via the file:// URI-scheme, but that's not guaranteed to work everywhere because of security-reasons and will fail for things such as AJAX requests. It ...


2

What you're looking for is the Time object. And Time.time in particular. Time.time contains the time in seconds since the game has started (or the level has been loaded). So you want to know how many seconds elapsed since the player is on the board. Just save the Time.time value when you want to start counting and then, in the Update method, you can easily ...



Top 50 recent answers are included