Jump to content

pac-man behaviour using tweens (without the worldbounds).


Recommended Posts



How can you implement a pacman like behaviour without using worldbounds?

Say that I have a 5x5 grid in the middle of the stage. Whenever a sprite exits the grid I want it to 'wrap around '.


I could do something like

  • tween a sprite till the end of the grid
  • teleport it just outside the other side of the grid
  • tween it to its destination

But this would seem like a glitch in the teleportation part.


It would be nicer to have the grid simulate the game bounds and if a sprite exits the stage , the teleportation to the other side would be transparent.


This effect could be achieved using a mask, but I don't know if such a thing can implemented using phaser.


Sorry If I sound weird, it was just random thoughts...

Does anyone has any ideas on how to implement such a behaviour?


Thank you



Link to comment
Share on other sites

Hm... if I understand the problem is that if you "teleport" the sprite than for brief second it will disappear or it will disapear early because it hit the right side....


I'm not realy into tween animation... but beside that there is example where sprite goes out from one side and then comes form the the other:



Link to comment
Share on other sites

This example uses world bounds, we can see the sprite exiting the "world" and the "teleportation" happens when the player is completely out of the scene.

If the "world" was not taking the full width of the screen, how could we create the same hiding effect to the sprite?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...