Jump to content

Search the Community

Showing results for tags 'time'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

  1. I need an area where like half the screen will only do 50% the normal physics calculations! This will be useful for items inside water areas
  2. Hi, is it possible to show a timer indicator when the gaze is pointing at a plane in VR mode? Would like to do it like the video that i've attached here loading.mp4
  3. sout7

    Cliclock

    Goal Cliclock challenges your sense of time by having you click 10 times at 1 second intervals. While clicking, you get feedback on how off the target you are. Positive values mean you were too slow, negative mean you were too fast. You can change the number of times to click, as well as the interval. In the options menu, you can even set the measurement as beats per minute. How accurate are you? Links Web: https://cliclock.netlify.com/ Google Play: https://play.google.com/store/apps/details?id=com.cliclock.free Note: The game is available on Google Play, but it is an HTML5 game! It simply has a Cordova version.
  4. I would like a timer to display in the top right of the game window. the time to be counting up in seconds . milliseconds to the 3rd decimal ( 00.000 ). i've found lots of examples to show an event on timer but not to just keep track of the game time and display. I'm assuming I need something in the update function to keep the time updating but not sure what. vaultage.game = function() {}; vaultage.game.prototype = { create : function() { // timer this.timer = game.time.create(); this.game.add.text(20, 700, this.timer,{ font: "10px Raleway"} ); this.timer.start(); }, update : function() { }, shutdown : function() { }, }
  5. So I am building a game where I for some parts use tweens that interact with gameplay. Other parts of the gameplay are based on time.physicsElapsed. I believe using time.physicsElapsedfor every frame (call to update) should cause the gameplay to slow down together with the fps, which is what I'd like to have as I have decided that is the most graceful way to deal with weak devices. What I am confused about is how tweens are timed. http://phaser.io/docs/2.6.2/Phaser.TweenManager.html#frameBased makes it look like only frameBased Tweens are using the physics time and that isn't the default setting. http://phaser.io/docs/2.6.2/Phaser.Time.html explains that Physics Time is used for tweens. Which seems to contradict the above finding. So if I combine tweens with other timings that work on counting time.physicsElapsedin each update() call will that work consistently or not? I am worried that fps drops will slow down some parts of the gameplay, but not others. Do I need to switch the tween manager to use frameBased tweens if I want it to stay in sync with the rest of the physics time in low fps situations or not?
  6. Hi, I'm a Phaser beginner. I'm using IntelXDK + Phaser.io theme (version 2.6.1). I'm trying to user a simple time event to stop an animation after 6 seconds. I think it is because the notation name: function () {} provided by intelXDK model that I'm using but I'm not sure. PS: If I use only the name of the function (instead of BasicGame.Game.prototype.happyMsgSystem), it doesn't work. The code: BasicGame = { }; BasicGame.Game = function (game) { }; BasicGame.Game.prototype = { preload: function () { this.load.spritesheet('button', 'asset/planet3.png', 59, 58,6); this.load.spritesheet('robot', 'asset/robot/robot-sprite.png', 587, 587,5); }, create: function () { //this.button = this.game.add.button(this.game.world.centerX - 95, 400, 'button', BasicGame.Game.prototype.happyMsgSystem, this, 2, 1, 0); this.game.time.events.add(Phaser.Timer.SECOND * 6,1,BasicGame.Game.prototype.happyMsgSystem,this); }, happyMsgSystem: function () { this.robot.animations.add('happyMsg', [1,2], 2, true); this.robot.play('happyMsg'); }, };
  7. HI, I am moving trains on a track in a callback registered with scene.registerBeforeRender() I need the time delta since the last call before I can update the train position. How do I get the dt ? Thanks.
  8. Hi all, I want to do something simple, tell a Phaser.Timer to: repeat 10 times in speed A, wait A seconds then repeat 3 times in speed B, wait B seconds then repeat X times in speed C wait C seconds etc... Is there a simple way of doing that? thanks! Lior
  9. Hi guys, for my game i use a emitter (game.add.emitter) for a snowing weather effect. When i start the state the emitter starts as well. So it looks like it has just started to snow right at the moment the player starts the game. Is it possible to advance the emitter progress. So it looks like the emitter does its work for a while? thanks Tom
  10. Hello to everybody, I wanted to share with you my first HTML5 game! The idea behind the game is very simple: collect all the coins you need in order to pass the level before the time expires. Sound simple? No it's not, it's actually very challenging and you will probably hate and love this game at the same time (but please just don't blame me if you will eventually drop your macbook pro out of the window). You can play it and/or get more informations trough this link. I'm looking forward to get some feedback from this community, please give me your suggestions. At present I'm selling it on www.fgl.com (is it a good way? I have no idea) where the game has been approved and rated with a score of 7 out of 10.
  11. I'm working with different states. Where I have all code of gameplay called "ingame" Ok, I'll use it when calling the game.time.events.add function receives the following parameters: game.time.events.add (1000, this.myFunction, this, arguments); Use this follow: add(delay, callback, callbackContext, arguments) So far so good. The problem comes when wanting to use this function from an extended sprite update (created by me). When I call the function from there "this" refers to the sprite, so you can not put "this" in the third parameter of the function. The context when I use this is SpriteExtended.prototype.update = function() { ... } , so, the "callbackContext" parameter which is now? What should I put? Thank you !!
  12. How to disable fixed FPS in version 2.4.3? is it possible? Or, can disable tunneling in early state play? Low FPS at begin of my game (after version 2.2.0). Solution to problem in http://www.html5gamedevs.com/topic/10345-phaser-220-release-candidate-11-please-test/ i could not found. Until I see that the only way out is to use 2.1.3.
  13. Hi everyone, I want to make a basic rhythm game in Phaser where the user has to hit specified keys to 'catch' the incoming notes while staying in rythm. So far the main game area roughly looks like this: The idea is that the key must be hit (and the corresponding note played) when the note sprite fully overlaps the key sprite, and the score is calculated based of how close the note sprite is to the top edge of the key sprite. I have an array of percussion loops with various BPMs I made in a DAW which change after each level to increase the difficulty. When the level starts this function is called: beginPlaying: function(l){this.noteCount = 25;this.currentLoop = this.loops[l];this.currentLoop.play();this.maxInterval = this.currentLoop.durationMS/4;this.timer.add(0, this.generateNotes, this);this.timer.start();},generateNotes function goes like this: generateNotes: function(){if(this.noteCount > 0){var num = this.game.rnd.integerInRange(0, 4);var note = this.notes.create(this.noteFlags.getAt(num).x, this.game.height - 20, 'note');this.game.physics.arcade.enable(note);var distance = note.y - this.noteFlags.getAt(num).y;note.body.velocity.y = -(distance/(this.currentLoop.duration/2));this.noteCount--;this.timer.add(this.maxInterval, this.generateNotes, this);}},I'm planning to make it more complicated by spawning notes not only at maxInterval, but so far I'm facing a problem: even though the first few notes seem to land perfectly in rhythm with the currentLoop, later they stop keeping up with the drums and the whole thing goes completely out of sync. I suppose this has something to do with the sound duration in ms and the fact that this.maxInterval is not a whole number. I tried rounding the numbers using Math.round and Math.floor and I also tried alternative methods of calculating note positions, like n.y -= (distance/(this.currentLoop.duration/2))/60;called using this.notes.forEachAlive method from the update function. Right now I'm completely lost (I guess that's the price you pay when you start programming while not being very good at maths ). Is there any way to deal with the audio/velocity sync problem? I would very much appreciate any suggestions Thanks!
  14. Hi I'm new to Javascript and trying to learn Phaser by building a simple rhythm game. in short you tap along to the beat of a song. You know when to tap by a horn sound. I have created a function that calculates when the sound should play in the given time in minutes and stores it to an array like this: function songManager(evt) { this.notes = []; storage['currentBpm'] = evt.bpm storage['eighthNoteDuration'] = 1000 * 0.5 * 60 /evt.bpm ; this.totalBars = (storage['eighthNoteDuration'] * 32) / storage['totalTime'] ; // Set global notes array for (var bar =0; bar < this.totalBars; bar ++){ //console.log(bar); var noteTime = bar * 8 * storage['eighthNoteDuration']; this.notes.push(noteTime + 2 *storage['eighthNoteDuration'], noteTime + 8 * storage['eighthNoteDuration'] ); } storage['notes'] = this.notes; function calculateBar(evt) { this.notes.push(evt ); } I'm having trouble keeping track of time in my game.js and comparing it to the time in my array. I start the song and the timer: songStart: function() { this.previousTime = this.song.currentTime; this.song.play(); this.lastReportedPlayheadPosition = 0; this.songPlaying = true; },and then update the time in the update function: this.songTime = this.song.currentTime - this.previousTime; this.previousTime = this.song.currentTime;then I check to play the horn in a function called every update also : tapActive: function() { if(this.songPlaying == true){ for ( var i =0; i < storage['notes'].length; i++){ if (this.songTime == storage['notes'][i] ) { this.horn.play(); this.input.onDown.addOnce(this.isDown,this); } else { this.input.destroy(); } } } },At the moment my horn does not play at all and the input never turns active. I know I might be asking a lot but any suggestions or a better idea of how to do this would be much appreciated. Thank You!
  15. Hi everyone, I have to code a special feature which is, I guess, quite tricky. Thus I'd like to ask for advice before diving into some "bad-patterned" solution. I have a game where a character can consume an item which will slow down time for everyone / everything except the character himself. So everything is going to move slowly around him (and animate slowly), for a given period of time. He won't get any other special bonus (he keeps moving at the same speed, jump as high as usual, only the rest of the world is affected). What would be the best way to implement this?
  16. Okay so current project I'm working on is to make a platformer game which uses just a single level design but multiple stages featuring different mechanics in it. I have a death counter which counts the number of times the player jumps into the spikes from which upon dying they will respawn back at the beginning of the level I also have a timer which is counting the amount of time it take to complete the level. Now what I want to do is make it so upon reaching the pipes at the end of the level when they switch over to the next level the values from the death counter & level timer will carry over to the next level. So e.g. Level 1 - Stage 1 = 20 deaths and a finishing time of 50 seconds. Upon starting Level 1 - Stage 2 the death counter will start at 20 and the level timer will resume counting from 50 seconds. instead of at 0. Currently they're simply resetting back to 0 as you can see in the create function below. How would I go about doing this as I noticed there's not anything in the examples that can show me how to do this? My game can be accessible from http://mbrooks.bitbucket.org Code as follows - BasicGame.Game = function (game){ // When a State is added to Phaser it automatically has the following properties set on it, even if they already exist: this.game; // a reference to the currently running game this.add; // used to add sprites, text, groups, etc this.camera; // a reference to the game camera this.cache; // the game cache this.input; // the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it) this.load; // for preloading assets this.math; // lots of useful common math operations this.sound; // the sound manager - add a sound, play one, set-up markers, etc this.stage; // the game stage this.time; // the clock this.tweens; // the tween manager this.state; // the state manager this.world; // the game world this.particles; // the particle manager this.physics; // the physics manager this.rnd; // the repeatable random number generator this.map; this.layer; this.player; this.cursors; this.spikes; this.deathCounter; this.spikesCollision = false; this.stageTip; this.stageNumber; this.deathText; this.levelText; this.tipText; this.timeText; this.levelStartTime = 0; this.levelCurrentTime = 0;// this.deathTemp;// this.total; //this.timer; // You can use any of these from any function within this State. // But do consider them as being 'reserved words', i.e. don't create a property for your own game called "world" or you'll over-write the world reference.};BasicGame.Game.prototype ={ create: function () { console.log('Creating game state!'); //Change the stagebackgroundColour to classic Mario blue. //this.stage.backgroundColor = '#6888ff'; //Populate the local map attribute with the tilemap with they key "level" map = this.add.tilemap('level-' + BasicGame.current_level_id); //map = this.add.tilemap('level' + BasicGame.current_level_id); //Assign the "level_tiles" tileset to the tilemap data map.addTilesetImage('level_design', 'level-' + BasicGame.current_level_id); //map.addTilesetImage('level_design', 'level_tiles' + BasicGame.current_level_id); //Populate the local layer with the combined level data. layer = map.createLayer('level_design'); //Resize the game world to fit the level data. layer.resizeWorld(); this.physics.startSystem(Phaser.Physics.ARCADE); map.setTileIndexCallback([12,13,14,15], this.PlayerDie, this); map.setTileIndexCallback([21, 25,26], this.nextStage, this); map.setTileIndexCallback(29, this.ButtonPressed, this); map.setCollision([0,1,2,3,4,5,25,26,27,28], true); player = this.add.sprite(135, 110, 'mario'); //total = 0; deathCounter = 0; // deathCounter = deathTemp; this.physics.arcade.enable([player]); this.physics.arcade.gravity.y = 500; player.body.collideWorldBounds =true; player.body.setSize(12, 16, 2, 0); cursors = this.input.keyboard.createCursorKeys(); player.animations.add('run',[0,1,2],10,true); player.animations.add('stand',[6]); //Shows the stage number for this stage deathText = this.game.add.text(1050, 725, 'Total Deaths: 0', { font: '20px Arial', fill: '#fff', align: 'center' }); if (BasicGame.current_level_id == 1) { levelText = this.game.add.text(125, 725, 'Level 1 - Stage 1', { font: '25px Arial', fill: '#fff', align: 'center' }); tipText = this.game.add.text(125, 770, 'Normal Movement', { font: '20px Arial', fill: '#fff', align: 'center' }); } else if (BasicGame.current_level_id == 2) { levelText = this.game.add.text(125,725, 'Level 1 - Stage 2', { font: '25px Arial', fill: '#fff', align: 'center' }); tipText = this.game.add.text(125,770, 'Inverted Movement', { font: '20px Arial', fill: '#fff', align: 'center' }); } /* else if (BasicGame.current_level_id == 2) { levelText = this.game.add.text(125,725, 'Level 1 - Stage 2', { font: '25px Arial', fill: '#fff', align: 'center' }); tipText = this.game.add.text(125,770, 'Inverted Movement / Verted Movement Timer', { font: '20px Arial', fill: '#fff', align: 'center' }); this.timer.game.time.create(false); this.timer.loop(2000, update, this); this.timer.start(); }*/ timeText = this.game.add.text(1050, 770, 'Time: ' + 's', { font: '20px Arial', fill: '#fff', align: 'center' }); this.levelStartTime = this.game.time.time; }, update: function () { // Honestly, just about anything could go here. It's YOUR game after all. Eat your heart out! this.physics.arcade.collide(player, layer); if (BasicGame.current_level_id == 1) { if (cursors.left.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = -175; //Play the run animation player.animations.play('run'); } //Check if the right arrow is down else if (cursors.right.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = 175; //Play the run animation player.animations.play('run'); } //Neither direction is pressed. else { //Remove the player's physics body's horizontal velocity. player.body.velocity.x = 0; //Play the Stand animation player.animations.play('stand'); } //if the up arrow is pressed and mario is touching another physics body below. if (cursors.up.isDown && player.body.onFloor()) { //Give the player's physics body some vertical velocity. player.body.velocity.y = -375; } } else if (BasicGame.current_level_id == 2) { if (cursors.left.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = 175; //Play the run animation player.animations.play('run'); } //Check if the right arrow is down else if (cursors.right.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = -175; //Play the run animation player.animations.play('run'); } //Neither direction is pressed. else { //Remove the player's physics body's horizontal velocity. player.body.velocity.x = 0; //Play the Stand animation player.animations.play('stand'); } //if the up arrow is pressed and mario is touching another physics body below. if (cursors.up.isDown && player.body.onFloor()) { //Give the player's physics body some vertical velocity. player.body.velocity.y = -375; } } /* else if (BasicGame.current_level_id == 2) { total++ // if(total == 1) //{ if (cursors.left.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = -175; //Play the run animation player.animations.play('run'); } //Check if the right arrow is down else if (cursors.right.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = 175; //Play the run animation player.animations.play('run'); } //Neither direction is pressed. else { //Remove the player's physics body's horizontal velocity. player.body.velocity.x = 0; //Play the Stand animation player.animations.play('stand'); } //if the up arrow is pressed and mario is touching another physics body below. if (cursors.up.isDown && player.body.onFloor()) { //Give the player's physics body some vertical velocity. player.body.velocity.y = -375; } //} if (total == 2) { if (cursors.left.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = 175; //Play the run animation player.animations.play('run'); } //Check if the right arrow is down else if (cursors.right.isDown) { //Give the player's physics body some velocity on the x (horizontal axis). player.body.velocity.x = -175; //Play the run animation player.animations.play('run'); } //Neither direction is pressed. else { //Remove the player's physics body's horizontal velocity. player.body.velocity.x = 0; //Play the Stand animation player.animations.play('stand'); } //if the up arrow is pressed and mario is touching another physics body below. if (cursors.up.isDown && player.body.onFloor()) { //Give the player's physics body some vertical velocity. player.body.velocity.y = -375; } total = 0; } }*/ this.levelCurrentTime = this.game.time.time - this.levelStartTime; timeText.setText('Time: ' + this.levelCurrentTime/1000 + 's') }, ButtonPressed: function(sprite, tile) { map.replace(29, 31); map.replace(19, 41); }, nextStage: function(sprite, tile) { console.log("Next Level!"); BasicGame.current_level_id++; // deathTemp = deathCounter; this.game.world.setBounds(0, 0, 0, 0); //This Ensures the Level Bounds are reset this.game.state.start("Game", true, false); }, PlayerDie: function(sprite, tile) { deathCounter++; deathText.setText('Total Deaths: ' + deathCounter); sprite.kill(); player.reset(135, 110) map.replace(41, 19); map.replace(31, 29); }, quitGame: function (pointer) { // Here you should destroy anything you no longer need. // Stop music, delete sprites, purge caches, free resources, all that good stuff. // Then let's go back to the main menu. this.state.start('MainMenu'); }}
  17. Hi I'm trying to find a reliable way to calculate the time the game is being played and isn't paused. My scenario is that I want to show a "time left" counter on screen but I found out that game.time.now isn't reliable as it's counting even if game.paused is true. thanks
  18. I have a problem with phaser time. When the time is over I want it to display "Done!". I also notice sometimes when I restart the timer it adds more time? https://jsfiddle.net/knz4aczh/
  19. I have a problem with phaser time. When the time is over I want it to display "Done!". I also notice sometimes when I restart the timer it adds more time? https://jsfiddle.net/knz4aczh/
  20. this.score=this.game.time.totalElapsedSeconds().toFixed(0); this.score = this.score+5; say the first this.score = 5. I want the next this.score to equal 10. But instead, I get 55. I looked up the API, and it says this.score should be a number so I cannot understand why this is happening?
  21. Hi guys, I'm really new to Phaser and programing in general so I'm getting stuck really often with my first game. What I'm trying to do is some sort of a two players fighting game (this is a game for gamepads and keyboards, no mobile here). I kinda have the basics going, I mean, my characters move! But i have a list of things to do that keeps growing! Here I have my first two problems for you, kind people: Problem number 1: The thing I'm trying to do is to have my character perform a special move with a combination of buttons. I'm guessing there should be a timer involved somehow. The idea is that if you press button 1 and quickly press button 2 and 3, a special move will happen (a set of frames of my animation sheet) but if you don't press them fast enough, then you will have the animations for each instead (button 1 is used for punching, button 2 is used for kicking and button 3 for blocking). Problem number 2: How can the punch o the kick hit player 2? I have the two sprits on screen, each of them are moving but they don't hit each other. I would need to have some sort of lifemeter or something, one for each player, and a value for punching, kicking and any other special move, which will affect the lifemeter of the player being hit. Many thanks in advance! I love this Phaser engine and the community in this forum. I'm really excited with this game
  22. Hi All, I'm developing a game where I'd like to slow game time when certain UI elements are expanded. I can use the .slowMotion of Phaser.Time (game.time.slowMotion = 2) to slow the global time which is great. However this also affects the rendering of the UI (animations etc). Question: Is it possible to specify a slow motion factor (or deltaTime) for a game object and its descendants somehow without affecting global time? Thanks, Tom
  23. Hi guys! One question... Is possible to do the following in phaser? http://flashvhtml.com/ I see that it have a timeline for the animations (translation, rotation and scale) and I would like do the same from a json. What do you recommend? Regards, Nicholls
  24. Hi all I have a little problem, i have set the collision of two spritse: game.physics.arcade.collide(sprite1, sprite2, this.collisionSprite, null, this);collisionSprite: function(){ variable++;}The problem is when the sprite1 collide with sprite2 the variable keep increasing, i want to increase the variable just one time, is there any solution please. And thank's for any help
  25. Hello again. New problems arise everyday! I have a character who has an animation called "hit". Here's the strip of frames. So in my code I have this little something that makes the character "hit" when the btnGolpe is down: btnGolpe = game.input.keyboard.addKey(Phaser.Keyboard.M); in function update (): else if (btnGolpe.isDown) { player.animations.play('golpe'); } The problems? 1) The animation keeps looping if btnGolpe is down. It should only play once per button pressing. 2) I need that the character actually "hits" it's opponent with his fist. Is there a way to do this? The collision should be between the fist and the opponent. Bare in mind that the fist is shown in one frame of the whole animation, so it show only register the collision in that frame, in that position (the fist, in this case). I'm really looking forward for your advise on these things. Thanks in advance, people!
×
×
  • Create New...