Feldposition auch in Minusbereich berechnen?

Übersicht BlitzMax, BlitzMax NG Beginners-Corner

Neue Antwort erstellen

 

bruce85

Betreff: Feldposition auch in Minusbereich berechnen?

BeitragSa, Mai 07, 2011 13:45
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo,
ich möchte die Feldposition auch in Minusbereich berechnen, wenn ich das so berechne:
BlitzMax: [AUSKLAPPEN]
Block[z].FeldX = ((Block[z].XPos+18-MapXPos)/36)
Block[z].FeldY = ((Block[z].YPos+18-MapYPos)/36)


dann funktioniert das zwar, aber sobald ich bei Position 0 bin, hab ich 2 mal den Wert 0 bei den Feldposition:
BlitzMax: [AUSKLAPPEN]
PositionY < 36 = FeldY 0
PositionY < 0 = FeldY 0
PositionY < -36 = FeldY -1
PositionY < -72 = FeldY -2

u.s.w.

Wie könnte man das Problem jetzt beheben?

Ich bedanke mich schonmal im Voraus.

MfG
AMD Athlon(tm) II X2 250, 8 GB DDR, MSI MSI 770-C45, GeForce GTS 250

BladeRunner

Moderator

BeitragSa, Mai 07, 2011 13:48
Antworten mit Zitat
Benutzer-Profile anzeigen
Block[z].FeldX = ((Block[z].XPos+18-MapXPos)/36)-1*(xpos<0)
Wenn deine Koordinate negativ ist ziehst du also eins mehnr ab Wink
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92
 

bruce85

BeitragSa, Mai 07, 2011 13:55
Antworten mit Zitat
Benutzer-Profile anzeigen
Vielen Dank.
Genau das hatte ich versucht gehabt, nur wusste ich nicht genau wie ich das in BM umsetzen soll.

Hab das jetzt so berechnet:
BlitzMax: [AUSKLAPPEN]
Block[z].FeldX = ((Block[z].XPos+18-MapXPos)/36)-1*(Block[z].XPos+18-MapXPos<0)
Block[z].FeldY = ((Block[z].YPos+18-MapYPos)/36)-1*(Block[z].YPos+18-MapYPos<0)


Jetzt funktioniert das endlich und vielen Dank nochmal für die Hilfe.

MfG
AMD Athlon(tm) II X2 250, 8 GB DDR, MSI MSI 770-C45, GeForce GTS 250

Neue Antwort erstellen


Übersicht BlitzMax, BlitzMax NG Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group