KLITZEKLEINES KollisionsProblem

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

 

fliege

Betreff: KLITZEKLEINES KollisionsProblem

BeitragDi, Mai 25, 2004 15:29
Antworten mit Zitat
Benutzer-Profile anzeigen
was muss ich tun, dass die Kollision richtig funktioniert? Ich habe ein ISO Spiel, wo die Kollision mit imagescollide abgefragt werden soll.
Ich habe hier aus Platzgründen nur den Code für die untere Pfeilteste geschrieben:
Code: [AUSKLAPPEN]

If koli = 1 Then
draw_player(animation)
EndIf

If  KeyDown(go_down)    ;;;nach unten;;;
turn = 0
koli = images_kollision()
px = px + 1
py = py + 1
scroolx = scroolx + 16
scrooly = scrooly + 12
 animation=animation_down
 animation_down = animation_down + 1
 If animation_down>46 Then
  animation_down=42
EndIf
EndIf

Function images_kollision()
kollision = 1
If turn = 0 Then
If ImagesCollide(Spieler, px, py, animation, G, px+1, py+1, 0) Then kollision = 1
If ImagesCollide(Spieler, px, py, animation, W, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, Bu11, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, Bu12, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, Bu21, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, Bu22, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B116, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B117, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B118, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B119, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B120, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B121, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B316, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B317, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B318, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B319, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B320, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B321, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B416, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B417, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B418, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B419, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B420, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B421, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B516, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B517, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B518, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B519, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B520, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B521, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B616, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B617, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B618, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B619, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B620, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B621, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B622, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B623, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B624, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B625, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B626, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B627, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B628, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B629, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B630, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B631, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B632, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B633, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B634, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, B635, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, TB7, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, TB8, px+1, py+1, 0) Then kollision = 0
If ImagesCollide(Spieler, px, py, animation, TB9, px+1, py+1, 0) Then kollision = 0
EndIf
End function

Doch jetzt wird nicht mehr einmal der Spieler gezeigt, denn aus irgendeinem Grund wird dann die koli zu 0. Bitte helft mir schnell, da ich sonst nicht mehr viel zu tun habe...
Fliege
 

Dreamora

BeitragDi, Mai 25, 2004 15:32
Antworten mit Zitat
Benutzer-Profile anzeigen
geht glaub kaum noch komplizierter wa ...


Code: [AUSKLAPPEN]

Function images_kollision()
kollision = 0
If turn = 0 Then
If ImagesCollide(Spieler, px, py, animation, G, px+1, py+1, 0) Then kollision = 1
end if
end function
 

fliege

BeitragDi, Mai 25, 2004 19:17
Antworten mit Zitat
Benutzer-Profile anzeigen
cih weiß nicht, aber es scheint, als würden nun beide Codes nicht mehr funktionieren...

Kabelbinder

Sieger des WM-Contest 2006

BeitragDi, Mai 25, 2004 21:20
Antworten mit Zitat
Benutzer-Profile anzeigen
Also ich habe aus dem Code nicht entnehmen können, worum es dabei geht. Aber ich denke "kollision = 0" liegt daran, dass du zuerst prüfst, ob der Player an das Bild "G" Stößt und dann überprüfst du, ob das bild an andere Bilder stösst. Warum das?
Ich meine, wenn das Bild des Players an das Bild "G" stößt heist das doch nicht unbedingt, dass kein anderes Bild sonst an das Bild des Players Stoßen darf. Also ich denke, die Variable kollision wird zunächst 1 und dann (weil ein anderes Bild an das des players stößt) 0.
<Wing Avenger Download> ◊◊◊ <Macrophage Download>

Gossi

BeitragMi, Mai 26, 2004 9:25
Antworten mit Zitat
Benutzer-Profile anzeigen
Meinst du nicht, dass dir hier u.a. auch For-Next-Schleifen hilfreich sind?
Alle Wasser laufen ins Meer, doch wird das Meer nicht voller; an den Ort, dahin sie fließen, fließen sie immer wieder. (...) Was geschehen ist, eben das wird hernach sein. Was man getan hat, eben das tut man hernach wieder, und es geschieht nichts neues unter der Sonne. Geschieht etwas, von dem man sagen könnte: "Sieh, das ist neu"? Es ist längst vorher auch geschehen in den Zeiten, die vor uns gewesen sind.
 

fliege

BeitragMi, Mai 26, 2004 17:20
Antworten mit Zitat
Benutzer-Profile anzeigen
könnt ihr da vielleicht auch nur kleine Pseudocodes hereinschreiben?

Kabelbinder

Sieger des WM-Contest 2006

BeitragMi, Mai 26, 2004 17:59
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich fürchte, ich kann keinen Pseudocode anbieten, da ich wiegesagt aus dem Quelltext nur wage entnehmen kann, worum es bei dem Spiel geht, und wie es aufgebaut ist. Rolling Eyes
Aber in meinem Post steht eigentlich auch schon alles drin.
<Wing Avenger Download> ◊◊◊ <Macrophage Download>
 

fliege

BeitragMi, Mai 26, 2004 19:39
Antworten mit Zitat
Benutzer-Profile anzeigen
Um es ein bisschen näher zu beschreiben:
Es ist ein ISO RPG mit Diamond Mapping...
Bu11 und Bu12 sind zum Beispiel die beiden Teile für einen Busch. Ich möchte aber nicht, das der Spieler durch alles auser Sand(S) oder Gras(G) gehen kann, und frage deshalb immer wieder ab, ob diese Images nun
Kollidieren oder nicht.
Ich kann auch den gesammten Quellcode Uppen, dauert aber und ist sehr sehr schlecht kommentiert...
 

fliege

BeitragSa, Mai 29, 2004 7:33
Antworten mit Zitat
Benutzer-Profile anzeigen
da mir aus diesen angeben niemand helfen konnte, uppe ich einmal das ganze Projekt auf:
http://mitglied.lycos.de/churvus/Mumbika1.zip
Bitte, ihr könnt von mir aus alles umschreiben, doch helft mir mit diesem Kollisionssystem... BITTE Sad Sad Sad Sad Sad Sad Sad Sad Sad

Hubsi

BeitragSa, Mai 29, 2004 11:17
Antworten mit Zitat
Benutzer-Profile anzeigen
Sag mal, willst Du meine Festplatte einem Belastungstest unterziehen? Programme mit ununterbrochenem Festplattenzugriff starte ich nicht (s. Uhr). Zudem werden in der draw_player() bei jedem Durchlauf die Images neu geladen Evil or Very Mad Da kollision nur True oder False sein kann ist hier String völlig fehl am Platze. Es fehlt im Download eine Function und der Code ist sehr übersichtsfrei. Ist jetzt echt nicht böse gemeint, aber tritt das Teil in die Tonne (behalt die Grafiken, die sind wirklich gut) und mach einen Spaceshooter, Moorhuhn oder Tic Tac Toe. Da hast Du ein schnelleres Erfolgserlebnis und kannst jede Menge lernen Wink
Den ganzen Doag im Bett umanandflagga und iaz daherkema und meine Hendl`n fressn...
 

fliege

BeitragSa, Mai 29, 2004 11:42
Antworten mit Zitat
Benutzer-Profile anzeigen
ok, werd' ich machen... Ich nehm' das alles eh nicht böse gemeint auf, hab' ja auch schon vorher ein paar Progsprachen durchgemacht und habe dort so einiges zu hören bekommen...Danke!Werd' schaun' das ich deine(eure) Festplatten nicht mehr solchen tests unterziehe, aber das war nicht einmal Absicht, deshalb entschuldigt mich bitte, ich muss üben!
Fliege

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group