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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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