Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Removing ovals and lines???  (Read 1818 times)
0 Members and 1 Guest are viewing this topic.
Offline smythst

Innocent Bystander

Java games rock!

« Posted 2003-02-13 17:41:14 »

********SOS SOS SOS SOS********

I'm writing a game of Twixt for my design assignment this semester in college. Part of the game requires you to bridge two points. This I can do. However how do you remove an oval and line that you've already drawn. Also this must be done without affecting any of the other ovals and lines already drawn! I'm using a JPanel to draw onto by accessing it's getGraphics() method in my MouseClicked event handler.

Any help/advise anyone could offer would be great, thanks.
Offline Pops

Senior Newbie

I love YaBB 1G - SP1!

« Reply #1 - Posted 2003-02-13 17:47:25 »

Redraw the same line but using the background color...
Offline cfmdobbie

Senior Devvie

Medals: 1

Who, me?

« Reply #2 - Posted 2003-02-13 17:53:31 »

I guess you're just drawing the new items on top of the current graphics without erasing what's already drawn?

What you need to do is keep a list of all the things you're drawing, and clear the screen each frame before drawing all items.  To remove an item you have already drawn is then trivial - just remove it from the list of things to draw!

Hellomynameis Charlie Dobbie.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Ninja

Medals: 64

falling into the abyss of reality

« Reply #3 - Posted 2003-02-13 23:21:45 »

or, far simpler, you could set xor mode to a color, and draw the line.
To undraw the line, set xor mode to the same color,
and draw the same line a second time.

see. Graphics.setXORMode(Color c1)
Pages: [1]
  ignore  |  Print  

EgonOlsen (45 views)
2018-06-10 19:43:48

EgonOlsen (27 views)
2018-06-10 19:43:44

EgonOlsen (47 views)
2018-06-10 19:43:20

DesertCoockie (210 views)
2018-05-13 18:23:11

nelsongames (127 views)
2018-04-24 18:15:36

nelsongames (126 views)
2018-04-24 18:14:32

ivj94 (867 views)
2018-03-24 14:47:39

ivj94 (128 views)
2018-03-24 14:46:31

ivj94 (779 views)
2018-03-24 14:43:53

Solater (143 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!