Search the Community
Showing results for tags 'score'.
-
I'm currently making my first ever game and am fairly new to coding so I apologize if this code doesn't make much sense. In my game the player sprite changes with the collection of various items. When a certain item is collected I want it so that the score increases when the player is in a certain zone and decreases when the player is out of that zone all while the player sprite is that specific model, and then I want the score to decrease if the player is in that zone while the sprite model isn't correct. (Sorry if that doesn't make sense!) Here is what I have so far: //in the update function: game.physics.arcade.overlap(player, laneC, laneCScoreModifier, null, this); //outside update function: function laneCScoreModifier (player, lane) { if (player.key == 'heroc') { timer = setInterval(plusScore, 1000); if (! game.physics.arcade.overlap(player, laneC)){ clearInterval(timer); } } else { timer = setInterval(minusScore, 1000); if (player.key == 'heroc') { clearInterval(timer); timer = setInterval(plusScore, 1000); if (!game.physics.arcade.overlap(player, laneC)){ clearInterval(timer); } } } } function plusScore(){ score++; } function minusScore(){ score--; } So my first guess is the '!' modifier isn't doing anything there. When I run the game once the player enters the zone while not having the correct sprite the timer never stops, even if they leave. Anyone have any idea how I should approach this? Any help will be greatly appreciated!
-
Spaceix is a simple and addictive endless runner game. Control the little rockets gliding through a beautiful exotic world. Collect coins and unlock cool in game rockets. Relaxed in the calm, zen-like background music. Hold and release so that the rockets takes off. Move away from the obstacles and pick up as many coins as you can.You get a score by traveling through the rings.The coins you pick up you can use in the game to buy rockets. Collect all the 40+ rockets. Be careful not to hit any obstacle or you will have to start again the game. Download on google play for free: https://play.google.com/store/apps/details?id=com.erkokos.spaceix .
- 1 reply
-
- spaceships
- space
- (and 15 more)
-
Hi all, I have code for a crystal count within my level at the moment, however when the player dies and the level resets, or when the player moves on to level 2 (in a new js file), the score resets as I've initiated it within level 1. Could someone please tell me how to create a variable that can be tracked and edited in every JS file, rather than just one? Thanks!
-
HEY! Guyz, this is so very confusing to me. All i want is to display a single string in one of the corners of the screen. With it i would display my score. So basicly what i would like to display is something like: var textToDisplay = "Score: " + gameScore; All the answers that i found (been working on this for few hours) were very confusing and basicly useless. I did find dynamicTexture.drawText and got it to work, but it had a few problems: -the text moved with camera (didnt stay in the corner), im guessing it has something to do with the renderingPlane. -the text didnt rewrite all the time so "Score: " is writen OK but the numbers just get writen atop of eachother, and after picking up the 1st coin its just a mess. Could you give me some pointers on how to solve this problem? Thank you very much! Satiana
-
Hey everyone, Here's my latest game, Rooftops : Rooftops is (another) game with the classic tap-to-jump gameplay. All you have to do is to jump from building to building. You can also pick up items which will slow the game down, making it easier. You also have to avoid hitting vents, as they will obstruct the view. It will probably be the last game for some time, as I lack both inspiration and free time to develop new ones. You can play it at http://rooftops.remvst.com/ Hope you will like it.
-
Hi there! I'm having a little issue with updating my game's score correctly. I set the score to += 10 on each click, but it gets stuck at 10. I also have my score displaying " score: [object Object]10 " instead of "score: 10". It probably has to do with how I added the score to the collectStar function? Here's my code: var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() { game.load.image('star', 'assets/images/star.png'); } function create() { //Score var score = 0; localStorage.setItem("save", JSON.stringify(score)); console.log('Score: '+ localStorage.getItem("save")) var scoretext; scoreText = game.add.text(16, 16, 'score: 0', { fontSize: '24px', fill: '#222' }); //Star Group starGroup = game.add.group(); for (var i = 0; i < 3; i++) {starGroup.create(game.world.randomX, game.world.randomY, 'star');} starGroup.setAll('inputEnabled', true); starGroup.setAll('input.useHandCursor', true); // Animate and destroy on star click starGroup.callAll('events.onInputDown.add', 'events.onInputDown', collectStar); } function collectStar (star, score) { // Add a timer before destroying star game.time.events.add(1000, star.destroy, star); // Add and update the score score += 10; scoreText.text = 'score: ' + score; localStorage.setItem("save", JSON.stringify(score)); console.log(localStorage.getItem("save")) } function update() {}
-
Demon’s Cave – a game in which you need to fly to a cave and dodge the rocks, collecting coins! Virgil – a brave demon hunter, his plane and enthusiastic attempts to catch the legendary demon planet Sirius 9. This is my second game in gamedev world, and first one for HTML5. Hope you will like it, and give me feedback) Demon's Cave Game
-
- sidescroller
- arcade
-
(and 3 more)
Tagged with:
-
I saw a few examples and games with implemented simple score logic. Seemed easy enough. But why is my counter updating like crazy? By each passed obstacle it jumps to 20 or so. Is it because the game loop calls each function 60 times per second. If so, what should I do? I want the counter to itterate by 1 each time an obstacle is passed(behind the player or out of bounds). The game is an endless runner type. My code: update{ obstacles.forEachAlive(this.passedObstacle, this); }, passedObstacle: function(){ var obstacle = obstacles.getFirstAlive(); if (obstacle.x < player.x) { obstacle.kill(); // with or without - same thing pass += 1; passText.text = 'pass: ' + pass; } }, // Tried with (obstacle.x < game.world.bounds.left) // AND // (obstacle.x + obstacle.width < game.world.bounds.left)
-
While its not recommended for a newbie to attempt the impossible, but I would really want to get right down to business in getting the Facebook API working in my game. I read there been games manage to implement API with no problem but didnt see much snippet with it. I'm gonna get SSL cert for my server to test the game thru facebook. Is there any advice on implementing Facebook API? p.s. hopefully it'll be painless :x
- 11 replies
-
- leaderboard
-
(and 2 more)
Tagged with:
-
Hi guys, do you know what's the best solution for a well performed game with automatically increasing game score and distance like other endless scroller? I've two different ways tested. In reality, the code looks something different. I do not know memorize everything. The important part is the function calling. In update game loop or with different timer parallel... 1. - Update distance every time in game loop (update()). 60 times, every second, the player moves a few px. This is a value between 0.3 and > 2, depending on the game speed. - Update score every time in game loop (update()). 60 times, every second, the score increase. This value starts with 0, depending on distance and a multiplier. 2. - Update distance every time in game loop (update()). 60 times, every second, the player moves a few px. This is a value between 0.3 and > 2, depending on the game speed. - Save all in a distanceTotal variable - Built a interval timer (create()) with 500ms to check score and make data tween (600ms) for a nice counter animation. Update score depends on distanceTotal-oldDistance, to tween the correct new score value. I think number 2 is faster than the other, but i'm not sure. We dont have a score checking and updating 60 times per second. But a second parallel running timer 2 times per second and a tween for the count animation. There could be a problem with the total game score.... i update the score every 500ms, but what when game ends between the interval? In number 1 i dont need a tween, because the update is so fast. Are there better solutions or is this the correct way? I would be very happy for some hints. Regards, Chris
- 9 replies
-
- performance
- score
-
(and 1 more)
Tagged with:
-
hi buddies, i wonder if is possible to change the initial value in a tween in order to get an endless score : i tried ////create function tween2 goes from 0 to 500 points=500; tween2 = game.add.tween(data).to( { score: points }, 2000); and check in the update function when the tween is onComplete and call a function to alter the initial data value and the points value. /// callback function when tween2 gets completed data.score = points /// alter the initial value of score to points points += 500; // increment points to 1000 not seems to work any idea?
-
Hi, how can i add a table to my game, i need the table to show the score of each played round. any idea ? can i add a html table in the game ? for the moment i'm using an image and i'm adding values using a text in front of the image but text go out of the table ( attached image) Thank you
-
Hello. I'm creating my first game; in that game you have to dodge enemies that are falling from the upper part of the screen. (Something like "game & watch" games) The score is going to update each second, so it will tell you the amount of time that you survived, but the problem is that I have no clue how should I do it... Can someone help me? Thank you so much in advance.
-
Hey! Here is Rollik, a game i've made for Android with CocoonJS. It's a simple concept, and for no reason i can't stop playing... My brother is actually the higher score with 24, tell me what's yours. Google Play https://play.google.com/store/apps/details?id=com.FireTotemArena.Rollik Instructions - Tap and hold to keep engine activated. - Fuel remaining is represented with the colored ball inside Rollik. The smaller it is, the less fuel Rollik has. - Completely land on a platform to start refueling (the colored ball will become green). - While refueling, you can't take off until you leave the platform (the colored ball will become red if you try). Keep pressing with your finger and it will automatically take off when leaving the platform. That's all. Have fun!!
-
Hello I need help with this instead of adding the score I would like for to take away Below is the code to add the score but All I want to Know is how to take away a score game.scene.addScore(); thanks
-
Hi all. This is my first ever HTML5 game. Your goal in the game is to collect as many monsters as you can during three rounds. Different monsters are worth different amounts. Below are some screens. I would love your feedback on this game. I always strive to create the best games possible. If anyone is interested in a license of the game you can PM me or send an email to contact at karmaoctopus.com Game link: http://m.karmaoctopus.com/monstercollector/