Jump to content

How to delete the already create line in phaser


parwaniprakash
 Share

Recommended Posts

Hello everyone,

 

         I am creating a game where multiple lines are created according to time. I need to delete the line on one click on that line. I am using this code for line creation:-

 

graphic.moveTo(50, 50);

graphic.lineTo(200, 250);

 

using this code line got created.. now I need to delete this line on clicking any part of the line.

 

Thanks for your response in adavance..

 

Thanks

Link to comment
Share on other sites

As a game is painting the whole screen at each frame, you should simply stop drawing this line. You don't have to care about removing something. The update-method of Phaser clears the canvas and draws everything you want at the next frame.

 

This is a common technique for games. Hiere you'll find more information about a common game loop: http://gameprogrammingpatterns.com/game-loop.html

 

And more infos about common patterns are here: http://gameprogrammingpatterns.com just read it online or get it as ebook or printed book.

Link to comment
Share on other sites

  • 3 months later...

Hello 

 

I need to drag the line from its any point and merge it to new node to make a new route.  For eg. there is a path of train we have created and now I want to change the path by dragging the current path to new node. is there any possiblity to do that..

 

waiting for your response. 

 

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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