• Content Count

  • Joined

  • Last visited

About Julia

  • Rank
    Advanced Member

Recent Profile Visitors

948 profile views
  1. I think you can just add in your onAnimationComplete: figure1.frame = 0; You also don't need to add an animation for only one frame. Hope this helps
  2. Ah yes, that was indeed the problem Now I have this: create: function () { count = 0; score = game.add.text(20 , 20, "0 / 10", fontStyle); score.fixedToCamera = true;},updateText: function() { score.setText(count + " / 10");},Thanks a lot!!
  3. Thanks for you answer, Mariusz. That seems to make sense. But how would I return the score back to zero? I tried this: create: function(){ score = 0; score = game.add.text(20 , 20, "0 / 10", fontStyle); score.fixedToCamera = true;},updateText: function() { score.setText(count + " / 10");},But still the same problem... Or did you mean the 'count' variable?
  4. Hey, I've added a 'complete' state to my game. Here is a playable example: juliahofs.nl/platformer3/platformer_test.html You have to pick up all 10 coins to be able to see the problem. When you see the text, just click on the screen and continue. I've put this piece of code in it: Platformer.Complete = function (game) {};Platformer.Complete.prototype = {create: function () {var wonImage = game.add.sprite(game.world.centerX, 200, 'IWon');wonImage.anchor.setTo(0.5, 0.5);var restartText = game.add.text(game.world.centerX, 500, "START", {font: "35px Roboto", fill: "#000", align: "center"});restartText.anchor.setTo(0.5, 0.5);restartText.inputEnabled = true;restartText.events.onInputDown.add(function() {game.state.start('Play');}, this);}};When I click the start text, the game only flickers. It doesn't restart the game. I'm guessing it has something to do with the onInputDown event? Or should I destroy the image and the text of the complete state (I thought this was done automatically when changing states). Any tips?
  5. Julia

    Moving platforms

    Okay, going to try that. Thanks for your help! I'll mark your answer as correct, because it did work
  6. Julia

    Moving platforms

    markusT, your solution is working, but the problem seems it won't work on only one platform from my group, why I've used platforms.getAt(3). Eventually about 5 out of 20 platforms or so should be moving. So I can get this to work on all platforms but that's not what I meant
  7. Julia

    Moving platforms

    Thank you for your answer Sam. Still not working unfortunately I have physics enabled, this is the piece of code I have in my create function : platforms = game.add.group();platforms.enableBody = true;platforms.physicsBodyType = Phaser.Physics.ARCADE;var platform = game.add.sprite(x, y, 'platform');game.physics.enable(platform, Phaser.Physics.ARCADE);platform.body.immovable = true;platform.body.allowGravity = false;platform.body.collideWorldBounds = true;platforms.add(platform);It's moving from left to right, but when it collides with the world bounds, it just stops...
  8. Julia

    Moving platforms

    Thanks for you answer Unfortunately it's still not working... I think maybe because I'm referring to a child of a group? Or shouldn't this be a problem?
  9. Julia

    Moving platforms

    Hey, I was wondering how I could get a few platforms to move from left to right and back, using platforms from my platformgroup. The problem is the platform isn't bouncing back from the sides and changing the velocity to + or -. Currently I have this (for only one platform): platforms.getAt(3).body.velocity.x = -100;platforms.getAt(3).body.bounce.set(1);Any suggestions?
  10. Thank you! Ah thanks for the edit, I'm not getting the error anymore . But it still isn't functioning how it should... Do you get an overlay with text when you pick up a coin? Here the game 'pauses' I guess, the coin also gets killed, but I'm not seeing anything from the pausefunction (black overlay and text). Also I can't resume the game. Edit: if you go to: http://juliahofs.nl/platformer2/platformer_test.html you can see what I mean. Thanks for your efforts!
  11. Omg you're right. Don't know how I could have not seen this haha. But the weird thing is, it used to work, also with my platforms... I've changed it now to be: coinGroup = game.add.group();coinGroup.enableBody = true;coinGroup.physicsBodyType = Phaser.Physics.ARCADE;coin1 = game.add.sprite(20, 0, 'coins');//coin1properties here.....coinGroup.add(coin1);But it's still giving the same error: Uncaught TypeError: Cannot read property 'length' of undefined I've tried both with .kill(); and .destroy(); ...
  12. But the coin1 is a child of a group right? I already had a coinGroup before and it worked... If I test it with destroy, I hear the 'coinmusic' playing constantly during the overlap with the player and the coin. The coin disappears, but no pause screen appears and the player becomes immovable... I guess the player becomes immovable because the game is paused?
  13. Thanks. Yeah you're right about the animations, should do that. Regarding the variables, I've first had it the way you said, using this, but I found it to be a bit too overwhelming with this amount of code... But I guess I should try that again yeah I'm actually really lost here.. It could be something in the comparison of (coin == coin1) or something in the time.events.add, where the callback function isn't executing...or something else.. Have you still got ideas?
  14. Haha wow. Wouldn't guess I would be able to help someone with my noob-ness hahaha
  15. Yes I'm using prototyping. I can upload the game to my site. Don't mind the long threads where I'm too inexperienced to use loops Here it is: juliahofs.nl/platformer/platformer_test.html