F
Flare
Hi. I know ms.public.dotnet.framwork.drawing was a better choice for this
qustion, but noone in there ssems to have an answere, so here we go.
Im trying to make a little tank game in C#. Everything is working out great.
Now i
need to check if my tank is colliding with an obstacle (a collection of
Rectangles).
Now when i paint my tank i use transformations like this:
....onPaint(...)
grfx.TranslateTransform(Placement.X,Placement.Y);
grfx.RotateTransform(Direction);
// This is my Tank(!);
grfx.FillRectangle(Brushes.GreenYellow, -15f, -30f, 32, 60);
grfx.RotateTransform(-Direction);
grfx.ResetTransform();
As you see it can rotate as it moves. But when I calculate the now possition
for the tank i also want to check if the tank is Intersecting with one of my
Obstacles (an arrayList with Rectangles).
But HOW do i create an Reactangle object wich is simular to the
FillRectangle is draw in my PainEvent so I can compare it to my reactangles
in the Arraylist of obstacles?
Im stuck and hope for at good advice.
(How is collission nomally done...i mean things gets more complicate as i
see when things aint Rectangles anymore?)
Reagards
Anders J, Denmark
qustion, but noone in there ssems to have an answere, so here we go.
Im trying to make a little tank game in C#. Everything is working out great.
Now i
need to check if my tank is colliding with an obstacle (a collection of
Rectangles).
Now when i paint my tank i use transformations like this:
....onPaint(...)
grfx.TranslateTransform(Placement.X,Placement.Y);
grfx.RotateTransform(Direction);
// This is my Tank(!);
grfx.FillRectangle(Brushes.GreenYellow, -15f, -30f, 32, 60);
grfx.RotateTransform(-Direction);
grfx.ResetTransform();
As you see it can rotate as it moves. But when I calculate the now possition
for the tank i also want to check if the tank is Intersecting with one of my
Obstacles (an arrayList with Rectangles).
But HOW do i create an Reactangle object wich is simular to the
FillRectangle is draw in my PainEvent so I can compare it to my reactangles
in the Arraylist of obstacles?
Im stuck and hope for at good advice.
(How is collission nomally done...i mean things gets more complicate as i
see when things aint Rectangles anymore?)
Reagards
Anders J, Denmark