Autor Beitrag
zero_cool1986
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Mo 22.08.05 01:57 
Hi hab mal ne Frage also ich möchte so ne simple kolisionsabfrage machen meine figur ist ein bild meine begrenzung ist auch ein bild sobald mein bild mit der spielfigur das bild von der mauer berührt soll der button zum laufen auf enabled false geschaltet werden ich möchte nicht: if Image1.left=Image2.left weil er ja dann schon auf der mauer steht sobald die mauer berührt wird soll das passieren danke schon mal ich hoffe mir kann jemand helfen... mfg ich


Moderiert von user profile iconChristian S.: Topic aus Projekte (Freeware) verschoben am Mo 22.08.2005 um 09:49
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 22.08.05 02:00 
Breite des Images hinzufügen...
Statt Image1.left=Image2.Left einfach Image1.Left + Breite=Image2.Left...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
zero_cool1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Mo 22.08.05 02:03 
stimmt warum bin ich da nich drauf gekommen ... aber sin trotzdem noch sauviele abfragen kennt jemand ne andere lösung? villeicht einfach auslesen was für ne farbe dahinterliegt oder so?
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 22.08.05 02:06 
Dahinter wirste nix finden, denn ein dahinter gibt es nicht. Auch wenn es so aussieht, das Canvas der Form ist nicht vielschichtig aufgebaut. Ich weis was du meinst, ich hatte das selbe Problem. hab es nie gelöst und bin zu ... "normalen" Programmen übergegangen und hab aufgehört zu versuchen, mit images Spiele zu basteln. Versuchs doch mal mit Suche in: Delphi-Forum, Delphi-Library OPENGL oder Suche in: Delphi-Forum, Delphi-Library DELPHIX

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
zero_cool1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Mo 22.08.05 02:11 
also telefonbücher und alles sowas speichern usw kann ich jetzt hab ich ein haufen tuts über opengl gelesen hab auch das meiste kapiert aber konnte mir fast nichts merken zB das mit der Inizialisierung naja .... wird schon.... ich stell das spiel dann mal rein is ganz simple einer is fänger einer ausreiser wenn spielfigur = spielfigur is dann hat fänger gewonnen man kann nen trunk einsammeln der die geschwindigkeit erhöht um 2 pixel left naja....
Pr0g
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 220


D7 Pers
BeitragVerfasst: Mo 22.08.05 02:17 
Du kannst mit Suche im MSDN INTERSECTRECT prüfen, ob sich zwei Rechtecke schneiden, denke dass ist genau was du suchst.

Hier noch nen Beispiel:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function CheckImages(const AImage1, AImage2: TImage): Boolean;
var
  fTemp: TRect;
begin
  Result := IntersectRect(fTemp, AImage1.BoundsRect, AImage2.BoundsRect);
end;

// Aufruf:
  if CheckImages(Image1, Image2) then
    Caption := 'Überschneidung'
  else
    Caption := 'Keine Überschneidung';
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 22.08.05 02:18 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function CheckImages(const AImage1, AImage2: TImage): Boolean;   
var   
  fTemp: TRect;   
begin   
  Result := IntersectRect(fTemp, AImage1.BoundsRect, AImage2.BoundsRect);   
end;   

// Aufruf:   
  if CheckImages(Image1, Image2) then   
    Caption := 'Überschneidung'   
  else   
    Caption := 'Keine Überschneidung';

Damits schöner aussieht ... ;)

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
zero_cool1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Mo 22.08.05 02:28 
??? also ich hab das jetz ungefähr so:


if image6.left=Image11.Left+35 then begin
button1.Enabled:=false; end else begin
if image6.left=Image11.Left-35 then begin
button1.Enabled:=false;


ja also das kapier ich nich ganz mit der funktion ...
Pr0g
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 220


D7 Pers
BeitragVerfasst: Mo 22.08.05 12:49 
Warum machst du es nicht einfach mit IntersectRect?
ausblenden Delphi-Quelltext
1:
Button1.Enabled := CheckImages(Image6, Image11);