Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 WHATDOTCOLOR!!!!
Index -> Programming, Java -> Java Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Spartan_117




PostPosted: Sat May 28, 2005 6:04 pm   Post subject: WHATDOTCOLOR!!!!

In turing i've used what dot colour for simple colision detection, and now i'm using Java. Does anyone kno the command for What Dot Colour in Java?

Thx
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sat May 28, 2005 6:28 pm   Post subject: (No subject)

Don't work that way in Java. Java has more sophisticated graphics capabilities. Make use of them. Rather than manually testing the color of pixels, keep track of where objects are on the screen, then do the collision detection separate from the graphics stuff entirely.
Spartan_117




PostPosted: Sun May 29, 2005 10:53 am   Post subject: (No subject)

Thats wut i'm doing, checking positions on screen. Im making the first Mario Bros game and im checking positions for colision detection between enemies and Mario, but for platforms I believe checking positions is a lot more complicated than needed, What dot Colour would work fine to check if mario has landed on a platform or not.
wtd




PostPosted: Sun May 29, 2005 11:49 am   Post subject: (No subject)

The approach I descried offers you flexibility. It's known as MVC: Model-View-Controller. You have code that displays the output and gathers input from the user (the View). You have code that maintains the state of the game, including things like player positions, enemy positions, obstacle positions, etc (the Model). And then you have code that communicates between them, taking a keypress from the View and chaning the Model, for instance (the Controller).
Spartan_117




PostPosted: Sun May 29, 2005 12:08 pm   Post subject: (No subject)

hmmm...sry, but i'm a little confused, what i was thinking was Mario will have (X1, Y1) and (X2, Y2), and the enemies will have the same, and i can detect collisions. is this wut ur talking about?
wtd




PostPosted: Sun May 29, 2005 1:27 pm   Post subject: (No subject)

Basically, yes. MVC sounds complicated, but a lot of us use it without even realizing it.
Spartan_117




PostPosted: Mon May 30, 2005 3:58 pm   Post subject: (No subject)

Well i've used MVC, but i'm still in need of what dot colour, so if any one knows how i can check the colour of given co-ordinates in Java, please help. So far i've come accross the PixelGrabber class, but not sure how to use it.
Martin




PostPosted: Tue May 31, 2005 9:11 am   Post subject: (No subject)

Whatdotcolour is a terrible way to do collision detection. If you're making Mario, you'll want there to be invisible blocks. How do you propose you'll do that with whatdotcolour?

Use bounding boxes and check for collisions in the background.
Sponsor
Sponsor
Sponsor
sponsor
Spartan_117




PostPosted: Tue May 31, 2005 9:36 am   Post subject: (No subject)

No i'm not using invisible blocks in my game. I'm making Mario Bros. which doesnt have any invisible blocks. I've already spoke to many people for my problem so what dot colour is definately what i'm in need of.
[Gandalf]




PostPosted: Wed Jun 01, 2005 9:35 am   Post subject: (No subject)

Have you ever actually played Mario Brothers? The real one?

First level (if I remebers correctly) *double checked*:
Jump past the fourth underground tunnel pipe thing, then just before the mountain in the background, jump. A box will appear, and a "1 up" will pop out.

You don't call that an invisible block?

*Edit I checked, looks like I haven't lost my Mario touch Very Happy*

*Edit 2 - Well, maybe...*



Mario2.jpg
 Description:
Poof
 Filesize:  11.23 KB
 Viewed:  3480 Time(s)

Mario2.jpg



Mario.jpg
 Description:
First Proof
 Filesize:  9.54 KB
 Viewed:  3475 Time(s)

Mario.jpg


Spartan_117




PostPosted: Wed Jun 01, 2005 9:48 am   Post subject: (No subject)

I believe you are talking about super mario. I'm talking about Mario Bros. This is the Mario with one level with pipes at the top. First two levels turtles come out of pipes. In this game you hit the floor with Mario's head from below to knock enemies, instead of jumping on them. Also, i'm sure you remember the POW box or button at the bottom of the screen. Hitting this would knock out all enemies.[/img]
Spartan_117




PostPosted: Wed Jun 01, 2005 9:48 am   Post subject: (No subject)

I believe you are talking about super mario. I'm talking about Mario Bros. This is the Mario with one level with pipes at the top. First two levels turtles come out of pipes. In this game you hit the floor with Mario's head from below to knock enemies, instead of jumping on them. Also, i'm sure you remember the POW box or button at the bottom of the screen. Hitting this would knock out all enemies.
1of42




PostPosted: Wed Jun 01, 2005 3:19 pm   Post subject: (No subject)

I think that's basically quibbling. The other posters on this thread are correct - it is better by far to use the coordinates of the various objects to do collision detection.

Whatdotcolour is a very limited method in the long run, and worse, it teaches you bad habits.
Hikaru79




PostPosted: Wed Jun 01, 2005 7:29 pm   Post subject: (No subject)

Spartan, take our word for it. We're not saying whatdotcolour will not WORK. It surely will, for some very limited purposes. However, we are saying it is NOT THE RIGHT SOLUTION for the job. The correct solution, as wtd has pointed out, is treating the logic of the game differently from its display. Figure out whether he's collided by always knowing where each object is in a logical format. Not by relying on cheap color tricks. Believe me, it will make your writing and debugging much easier.

They're not just insisting on this approach because they don't know how to answer your question or something. They're trying to steer you in the right direction.
McKenzie




PostPosted: Wed Jun 01, 2005 9:57 pm   Post subject: (No subject)

First off, Mario Bros is a great game for a final project that is very different from Gandalf's Mario (i.e. Super Mario Bro.) Second I'm not sure anyone who has posted knows how to use whatdotcolour in Java. The reality is it a POOR solution that no one can be bothered to look up. Mario Bro. the original has LESS of a reason to use whatdotcolour than Super Mario does.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: