Click here to Skip to main content
16,007,126 members
Home / Discussions / C#
   

C#

 
GeneralListBox and objects Pin
student_rhr25-Feb-08 11:29
student_rhr25-Feb-08 11:29 
GeneralRe: ListBox and objects Pin
led mike25-Feb-08 11:36
led mike25-Feb-08 11:36 
GeneralRe: ListBox and objects Pin
Not Active25-Feb-08 11:40
mentorNot Active25-Feb-08 11:40 
GeneralRe: ListBox and objects Pin
Luc Pattyn25-Feb-08 11:45
sitebuilderLuc Pattyn25-Feb-08 11:45 
GeneralRe: ListBox and objects Pin
student_rhr26-Feb-08 3:59
student_rhr26-Feb-08 3:59 
GeneralRe: ListBox and objects Pin
Luc Pattyn26-Feb-08 4:17
sitebuilderLuc Pattyn26-Feb-08 4:17 
QuestionCollision Help (XNA) : Please Help! Pin
MasterSharp25-Feb-08 11:17
MasterSharp25-Feb-08 11:17 
GeneralRe: Collision Help (XNA) : Please Help! Pin
Luc Pattyn25-Feb-08 11:38
sitebuilderLuc Pattyn25-Feb-08 11:38 
Hi,

I don't think we needed all that code to try and answer the question at the bottom...

I once did multi-object collision by drawing everything in a hidden bitmap, using:
- two colors only (empty and filled);
- reduced resolution (if everything is a multiple of 25, then divide all coordinates by 25).

In such a bitmap you can detect possible moves and collisions before you apply them to the
"real world". You may want to use more than two colors, say one for empty and one for each
of the objects, that way you know immediately with which object you are going to collide.

Final remark: it does not have to be a real Bitmap and GDI+ operations, you could simply use a
two-dimensional array and manipulate the "pixels" yourself, removing a rectangular object
is a simple clear in two nested fors, adding it at a (slightly) different position is similar.
Collision detection can be handled by just peeking at the intended new positions of the
leading edges.

BTW: nevertheless I like to do it in a paintable way, and for debugging purposes I have
a checkbox that chooses to show either the real world or the simulated world, at the same
location on screen (rescaled to undo the reduced resolution); doing so any bugs become
noticeable right away.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.


GeneralRe: Collision Help (XNA) : Please Help! Pin
MasterSharp25-Feb-08 11:58
MasterSharp25-Feb-08 11:58 
GeneralRe: Collision Help (XNA) : Please Help! Pin
Luc Pattyn25-Feb-08 12:02
sitebuilderLuc Pattyn25-Feb-08 12:02 
GeneralRe: Collision Help (XNA) : Please Help! Pin
MasterSharp25-Feb-08 12:19
MasterSharp25-Feb-08 12:19 
GeneralRe: Collision Help (XNA) : Please Help! Pin
Mark Churchill25-Feb-08 19:02
Mark Churchill25-Feb-08 19:02 
GeneralEncoding and the Streamreader Pin
KaptinKrunch25-Feb-08 10:18
KaptinKrunch25-Feb-08 10:18 
GeneralRe: Encoding and the Streamreader Pin
KaptinKrunch25-Feb-08 13:15
KaptinKrunch25-Feb-08 13:15 
GeneralRe: Encoding and the Streamreader Pin
Guffa25-Feb-08 14:17
Guffa25-Feb-08 14:17 
QuestionHow to get a file from a folder Pin
Exelioindia25-Feb-08 9:31
Exelioindia25-Feb-08 9:31 
AnswerRe: How to get a file from a folder Pin
pmarfleet25-Feb-08 9:37
pmarfleet25-Feb-08 9:37 
QuestionRe: How to get a file from a folder Pin
Exelioindia25-Feb-08 10:07
Exelioindia25-Feb-08 10:07 
AnswerRe: How to get a file from a folder Pin
KaptinKrunch25-Feb-08 10:29
KaptinKrunch25-Feb-08 10:29 
AnswerRe: How to get a file from a folder Pin
Gareth H25-Feb-08 10:04
Gareth H25-Feb-08 10:04 
GeneralRe: How to get a file from a folder Pin
Exelioindia25-Feb-08 10:28
Exelioindia25-Feb-08 10:28 
QuestionStatic Extension Methods? Pin
Skippums25-Feb-08 9:13
Skippums25-Feb-08 9:13 
GeneralRe: Static Extension Methods? Pin
Not Active25-Feb-08 9:27
mentorNot Active25-Feb-08 9:27 
GeneralRe: Static Extension Methods? Pin
Skippums25-Feb-08 9:38
Skippums25-Feb-08 9:38 
GeneralRe: Static Extension Methods? Pin
Pete O'Hanlon25-Feb-08 9:48
mvePete O'Hanlon25-Feb-08 9:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.