Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Taggrin last won the day on June 7 2016

Taggrin had the most liked content!

About Taggrin

  • Rank
    Advanced Member

Recent Profile Visitors

1178 profile views
  1. You can simply apply the same randomly taken location to both the trunk and leaves (only picking a new random for a each new tree). Then by adjusting the position of the leaves relative to the trunk or by setting an anchor you can make the leaves attach to the tree correctly.
  2. You can check if a certain function is called by adding a console.log and check your browser console. Anyway, what I always use for updating text is the following: labelScore.setText(score); Never used <object>.text so not sure if that would matter, but you can try I guess. I would also recommend to change your score before changing your text, otherwise it will always be 1 behind .
  3. I don't think you can disable it directly, as there is no way for the game to find out where the pointer moved once out of the canvas. Someone can correct me if wrong . One solution I can think of is that upon calling onUp() to check whether the mouse is still within the range of the game. For the example that would mean: game.input.mousePointer.x should be > 0 and < 800. game.input.mousePointer.y should be > 0 and < 600.
  4. Taggrin

    Pushable Object?

    You have most you require already in your code. Using the counterRM value you can check how many bullets did hit it recently so you can multiple the monkey.body.velocity.y with that value. However, this will increase the to ridiculous amounts if you hit too many times in a row. If you want it to maintain the same speed, but that it just lasts for longer, you need to remove the game.time.events and add your own timer. This way you can increase that timer after a successful hit. Something like this (sorry, for some reason the codebox doesn't want to display Javascript): //Define your ti
  5. Taggrin

    Pushable Object?

    You can try to switch game.physics.arcade.collide with game.physics.arcade.overlap, as that will remove the speed blocking of objects. It shouldn't matter for gameplay, as you kill the bullets upon touch anyway. This collision handler will not work perfectly for multiple bullet hits. Instead of tweaking the velocity you can add a number to a counter inside the collision handler. In the time.events you can reduce this number after a second. As long as the counter is higher than 0 the monkey should still go up. This also allows you to multiply the velocity with the counter, making the monke
  6. Taggrin

    Pushable Object?

    With moving up and down I assume you mean Y instead of X. Anyway, what you can do is setting the vertical velocity of the monkey to negative for a short moment after being hit. So let's say your monkey is moving down with speed 10 over time (monkey.body.velocity.y = 10;), you can do the following in your collision handler, where you also make the bullet disappear: //Set vertical speed to negative to move up monkey.body.velocity.y = -20; //Change vertical speed back after a short delay (in ms, so 1000 = 1 second) game.time.events.add(1000, function () { monkey.body.velocity.y =
  7. Taggrin


    Recently changed my website layout, but forgot to edit this post. Should work now .
  8. Taggrin


    Fair points. Since the voice thing was something just to try out I have only a limited number of them. I can turn the frequency easily down by not playing them at every "trap" but having like a 50% chance for them to play. I wasn't too sure about the start as well (especially when you have to restart a few times in a row), so I will do some cuts there as well. Will be testing some tweaks later today . EDIT: Startup is much faster now and voice acting does not trigger all the time.
  9. Taggrin


    It has been a while since I released a game, but I present you ... Pointer! An evil scientist hates mouse pointer so much that he wants to destroy them all! This game is what some of you might know as a "mouse catcher" game. The game will try to take out your mouse pointer by throwing various traps at you. Some traps can have rare different variants to try catch you off guard. You have to stay within the green octagon shaped area or you will lose straight away, mainly to avoid cheating but to also make it harder (too fast movement might get punished!). You can take up to 3 hits before you
  10. The 5th argument of moveToXY is optional and will set the maximum time the object may take to move, which will overwrite the speed if specified. Just leave out the 5th argument (value 0) .
  11. I don't use P2 that often, so I am not sure. Although I don't see you call the collision handler (collisionBulletFigura), but you might have cut that out. I always use this handler I took from on of the example and works like a charm. It may be a use to you as well. First you add the collision handler to the bullet/player object: bullet.body.onBeginContact.add(this.hitDetection, this); Collision handler: hitDetection: function(body, bodyB, shapeA, shapeB, equation) { if (body) { //The key is the name of the sprite used by the object you want to detect //E.g.
  12. You can do that yes. Personally I use the create function for objects I want to be there when the game starts. The rest is created on the flow. You can simply put a condition in your update function (e.g. button press) to call a function that will add a new sprite, just like you do in the create function. Make sure your conditions are correct though, as otherwise the function that adds the sprite gets called too much and will spam your game with objects.
  13. Just a guess as I can't see all code: I guess you have an object called "a" as boomerangBullets.children[0]. The function Math.atan2 is looking for the x/y value of that object (a.x and a.y). When you kill an object, it simply disappears but can still be called by the game (hence why that works fine). When you destroy an object, it gets completely removed. So it is likely that one part of your code is still calling Math.atan2 on object "a" after it got destroyed, resulting in this error.
  14. moveToXY does not stop the object, it simply moves it towards the location. If you use the maxTime argument you will know when your object will reach its destination and you can use a timer to stop the object at that exact same time, for example: //Move towards target in 2 seconds game.physics.arcade.moveToXY(player,320,240,0,2000); //Stop movement after 2 seconds (should be on target) game.time.events.add(2000, function () { player.body.velocity.x = 0; player.body.velocity.y = 0; }, this); Keep in mind that maxTime is not 100% accurate due to how browser timers work, so it
  15. Of course you can enter a variable instead of a number, just like any other function. That variable needs to be a number though. If you mean you also want to change the direction of the player (e.g. when the target moves) I think you can just override moveToXY with new values. So far I have never used tiles before to make a game so I'm not sure, maybe you can calculate the relative position to the tile based on the scale.
  • Create New...