memory access violation problem!!!

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

 

Fantomas

Betreff: memory access violation problem!!!

BeitragMi, Jul 04, 2007 18:20
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich bekomme dauernd die Fehlermeldung "memory access violation" , wenn ich mein spiel starte nach einer Weile.Es läuft nur kurz und manchmal etwas länger das Spiel.Ich habe schon gesucht wie ein irrer (bin allerdings noch ein Noob in B3D) und finde den Fehler nicht.
Vielen Dank im Vorraus

;----------Voreinstellungen------------
Graphics 800,600,16,1
AppTitle "MoorGhost"
Global frametimer = CreateTimer(50)
SetBuffer BackBuffer()
SeedRnd MilliSecs()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;---------Variablen--------------------
start_button = LoadImage("start_button.png")
MaskImage start_button,255,0,255
Global layer1 = LoadImage("schloss.JPG")
Global layer2 = LoadImage("layer2.png")
MaskImage layer2,255,0,255
Global layer3 = LoadImage("layer3.png")
MaskImage layer3,255,0,255
Global geisthl = LoadAnimImage("geistanimalphahl.png",25,25,0,7)
MaskImage geisthl,255,0,255
Global geistml = LoadAnimImage("geistanimalphaml.png",50,50,0,7)
MaskImage geistml,255,0,255
Global geistvl = LoadAnimImage("geistanimalphavl.png",100,100,0,7)
MaskImage geistvl,255,0,255
;;;geister rechts;;;;;;;;;;;
Global geisthr = LoadAnimImage("geistanimalphahl.png",25,25,0,7)
MaskImage geisthr,255,0,255
Global geistmr = LoadAnimImage("geistanimalphaml.png",50,50,0,7)
MaskImage geistmr,255,0,255
Global geistvr = LoadAnimImage("geistanimalphavl.png",100,100,0,7)
MaskImage geistvr,255,0,255
Global fadenkreuz = LoadImage("fadenkreuz.png")
MaskImage fadenkreuz,255,0,255
MidHandle fadenkreuz
Global start = 0
Global MH1 = MouseHit(1)
Global MH2 = MouseHit(2)
Global punkte
Global anim
Global maus_pos_x
Global maus_pos_y
Global layer1_pos_x
Global layer2_pos_x
Global layer3_pos_x
Global ghlposx
Global ghrposx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;------zubehör Regen-----------------
Dim X1(100), Y1(100), V1(100)
For i=0 To 100
X1(i)=Rand(0,799)
Y1(i)=Rand(0,599)
V1(i)=Rand(1,10)
Next
Function regen()
For i=0 To 100
Y1(i)=Y1(i)+V1(i)
If Y1(i)>599 Then Y1(i)=0: V1(i)=Rand(1,10)
Color 255,0,255
Plot X1(i),Y1(i)
Color 255,255,255
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;----------Types-----------------------

Type geisthl
Field ghlposx
Field ghlposy
End Type
;-----------
Type geistml
Field gmlposx
Field gmlposy
End Type
;------------
Type geistvl
Field gvlposx
Field gvlposy
End Type
;-----------
Global infohl.geisthl
Global infoml.geistml
Global infovl.geistvl

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;types rechts geister;;;;;;;;;;;;
Type geisthr
Field ghrposx
Field ghrposy
End Type
;-----------
Type geistmr
Field gmrposx
Field gmrposy
End Type
;------------
Type geistvr
Field gvrposx
Field gvrposy
End Type
;-----------
Global infohr.geisthr
Global infomr.geistmr
Global infovr.geistvr
;----------Menue-----------------------


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

geisthrf()
geistmrf()
geistvrf()

geisthlf()
geistmlf()
geistvlf()
;--------Hauptprogramm-----------------
Repeat
For anim = 0 To 6
WaitTimer frametimer
layer1()
geisthlc()
geistmlc()
geistvlc()
geisthldraw()
geistmldraw()
geistvldraw()
;rechtsgeister
geisthrc()
geistmrc()
geistvrc()
geisthrdraw()
geistmrdraw()
geistvrdraw()
layer2()
layer3()
punkte()
regen()
maus()
Flip
Cls
Next
Until KeyHit(1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




;----------Functionen------------------
;----------Layer1----------------------
Function layer1()
TileImage layer1, layer1_pos_x, y
If KeyDown(203) Or maus_pos_x < 50 Then
layer1_pos_x = (layer1_pos_x + 2)
For infohl.geisthl = Each geisthl
If layer1_pos_x < 0
infohl\ghlposx = infohl\ghlposx + Rnd(0.1,1) + 2
EndIf
Next
For infohr.geisthr = Each geisthr
If layer1_pos_x < 0
infohr\ghrposx = infohr\ghrposx - Rnd(0.1,4) + 6
EndIf
Next
ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
layer1_pos_x = layer1_pos_x - 2
For infohl.geisthl = Each geisthl
If layer1_pos_x > -400
infohl\ghlposx = infohl\ghlposx + Rnd(0.1,1) - 4
EndIf
Next
For infohr.geisthr = Each geisthr
If layer1_pos_x > -400
infohr\ghrposx = infohr\ghrposx - Rnd(0.1,4) - 2
EndIf
Next
EndIf
If layer1_pos_x > 0 Then layer1_pos_x = 0
If layer1_pos_x < -400 Then layer1_pos_x = -400
End Function

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




;------------Layer2--------------------
Function layer2()
DrawImage layer2,layer2_pos_x,y
If KeyDown(203) = 1 Or maus_pos_x < 50 Then
layer2_pos_x = layer2_pos_x + 4
For infoml.geistml = Each geistml
If layer2_pos_x < 0
infoml\gmlposx = infoml\gmlposx + Rnd(0.1,2) + 4
EndIf
Next
For infomr.geistmr = Each geistmr
If layer2_pos_x < 0
infomr\gmrposx = infomr\gmrposx - Rnd(0.1,4) + 6
EndIf
Next
ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
layer2_pos_x = layer2_pos_x - 4
For infoml.geistml = Each geistml
If layer2_pos_x > -800
infoml\gmlposx = infoml\gmlposx + Rnd(0.1,2) - 6
EndIf
Next
For infomr.geistmr = Each geistmr
If layer2_pos_x > -800
infomr\gmrposx = infomr\gmrposx - Rnd(0.1,4) - 4
EndIf
Next
EndIf
If layer2_pos_x > 0 Then layer2_pos_x = 0
If layer2_pos_x < -800 Then layer2_pos_x = -800
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-----------Layer3----------------------
Function layer3()
DrawImage layer3,layer3_pos_x,y
If KeyDown(203) = 1 Or maus_pos_x < 50 Then
layer3_pos_x = layer3_pos_x + 8
For infovl.geistvl = Each geistvl
If layer3_pos_x < 0
infovl\gvlposx = infovl\gvlposx + Rnd(0.1,1) + 8
EndIf
Next
For infovr.geistvr = Each geistvr
If layer3_pos_x < 0
infovr\gvrposx = infovr\gvrposx - Rnd(0.1,4) + 10
EndIf
Next
ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
layer3_pos_x = layer3_pos_x - 8
For infovl.geistvl = Each geistvl
If layer3_pos_x > -1600
infovl\gvlposx = infovl\gvlposx + Rnd(0.1,1) - 10
EndIf
Next
For infovr.geistvr = Each geistvr
If layer3_pos_x > -1600
infovr\gvrposx = infovr\gvrposx - Rnd(0.1,4) - 8
EndIf
Next
EndIf
If layer3_pos_x > 0 Then layer3_pos_x = 0
If layer3_pos_x < -1600 Then layer3_pos_x = -1600
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;---------geist hinten links-------------
Function geisthlf()
If Last geisthl = Null Then
v = Rnd(1,4)
EndIf
For i = 1 To v
infohl.geisthl = New geisthl
infohl\ghlposx = Rnd(-1000,0)
infohl\ghlposy = Rnd(50,500)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;----------geist mitte links--------------
Function geistmlf()
If Last geistml = Null Then
v = Rnd(1,3)
For i = 1 To v
infoml.geistml = New geistml
infoml\gmlposx = Rnd(-100,0)
infoml\gmlposy = Rnd(50,500)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne links---------------
Function geistvlf()
If Last geistvl = Null Then
v = Rnd(1,5)
For i = 1 To v
infovl.geistvl = New geistvl
infovl\gvlposx = Rnd(-1000,0)
infovl\gvlposy = Rnd(50,400)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;--------geist hinten links zeichnen------
Function geisthldraw()
For infohl.geisthl = Each geisthl
DrawImage geisthl, infohl\ghlposx, infohl\ghlposy,anim
infohl\ghlposx = infohl\ghlposx + Rnd(0.1,1)
infohl\ghlposy = infohl\ghlposy + Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist mitte links zeichnen-------
Function geistmldraw()
For infoml.geistml = Each geistml
DrawImage geistml, infoml\gmlposx, infoml\gmlposy,anim
infoml\gmlposy = infoml\gmlposy + Rnd(-5,5)
infoml\gmlposx = infoml\gmlposx + Rnd(0.1,2)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne links zeichnen-------
Function geistvldraw()
For infovl.geistvl = Each geistvl
DrawImage geistvl, infovl\gvlposx, infovl\gvlposy,anim
infovl\gvlposx = infovl\gvlposx + Rnd(0.1,4)
infovl\gvlposy = infovl\gvlposy + Rnd(0.1,1)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-------Kollision geist hinten links-------
Function geisthlc()
For infohl.geisthl = Each geisthl
If MH1 And ImagesCollide(geisthl, infohl\ghlposx, infohl\ghlposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infohl.geisthl
punkte = punkte + 1
geisthlf()
ElseIf infohl\ghlposx >800 Then
Delete infohl.geisthl
geisthlf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist mitte links-------
Function geistmlc()
For infoml.geistml = Each geistml
If MH1 And ImagesCollide(geistml, infoml\gmlposx, infoml\gmlposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infoml.geistml
punkte = punkte + 1
geistmlf()
ElseIf infoml\gmlposx >800 Then
Delete infoml.geistml
geistmlf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist vorne links-------
Function geistvlc()
For infovl.geistvl = Each geistvl
If MH1 And ImagesCollide(geistvl, infovl\gvlposx, infovl\gvlposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infovl.geistvl
punkte = punkte + 1
geistvlf()
ElseIf infovl\gvlposx >800 Then
Delete infovl.geistvl
geistvlf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;---------Punktestand-----------------------
Function punkte()
Text 600,550, "Punkte : " + punkte
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Geister rechts;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist hinten rechts-------------
Function geisthrf()
If Last geisthr = Null Then
v = Rnd(1,4)
EndIf
For i = 1 To v
infohr.geisthr = New geisthr
infohr\ghrposx = Rnd(1800,800)
infohr\ghrposy = Rnd(50,500)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;----------geist mitte rechts--------------
Function geistmrf()
If Last geistmr = Null Then
v = Rnd(1,3)
For i = 1 To v
infomr.geistmr = New geistmr
infomr\gmrposx = Rnd(1800,800)
infomr\gmrposy = Rnd(50,500)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne rechts---------------
Function geistvrf()
If Last geistvr = Null Then
v = Rnd(1,2)
For i = 1 To v
infovr.geistvr = New geistvr
infovr\gvrposx = Rnd(1800,800)
infovr\gvrposy = Rnd(50,500)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;--------geist hinten rechts zeichnen------
Function geisthrdraw()
For infohr.geisthr = Each geisthr
DrawImage geisthr, infohr\ghrposx, infohr\ghrposy,anim
infohr\ghrposx = (infohr\ghrposx - Rnd(0.1,2))
infohr\ghrposy = infohr\ghrposy - Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist mitte rechts zeichnen-------
Function geistmrdraw()
For infomr.geistmr = Each geistmr
DrawImage geistmr, infomr\gmrposx, infomr\gmrposy,anim
infomr\gmrposx = infomr\gmrposx - Rnd(0.1,4)
infomr\gmrposy = infomr\gmrposy - Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne rechts zeichnen-------
Function geistvrdraw()
For infovr.geistvr = Each geistvr
DrawImage geistvr, infovr\gvrposx, infovr\gvrposy,anim
infovr\gvrposx = infovr\gvrposx - Rnd(0.1,8)
infovr\gvrposy = infovr\gvrposy - Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-------Kollision geist hinten rechts-------
Function geisthrc()
For infohr.geisthr = Each geisthr
If MH1 And ImagesCollide(geisthr, infohr\ghrposx, infohr\ghrposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infohr.geisthr
punkte = punkte + 1
geisthrf()
ElseIf infohr\ghrposx =< 0 Then
Delete infohr.geisthr
geisthrf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist mitte rechts-------
Function geistmrc()
For infomr.geistmr = Each geistmr
If MH1 And ImagesCollide(geistmr, infomr\gmrposx, infomr\gmrposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infomr.geistmr
punkte = punkte + 1
geistmrf()
ElseIf infomr\gmrposx =< 0 Then
Delete infomr.geistmr
geistmrf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist vorne rechts-------
Function geistvrc()
For infovr.geistvr = Each geistvr
If MH1 And ImagesCollide(geistvr, infovr\gvrposx, infovr\gvrposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infovr.geistvr
punkte = punkte + 1
geistvrf()
ElseIf infovr\gvrposx =< 0 Then
Delete infovr.geistvr
geistvrf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;-------------Maus------------------------
Function maus()
If MouseHit(1) Then MH1 = True Else MH1 = False
maus_pos_x = MouseX()
maus_pos_y = MouseY()
DrawImage fadenkreuz,maus_pos_x ,maus_pos_y
End Function

hectic

Sieger des IS Talentwettbewerb 2006

BeitragMi, Jul 04, 2007 18:24
Antworten mit Zitat
Benutzer-Profile anzeigen
Und wie sollen wir jetzt aus dem Code ''mal so eben'' den Fehler finden?

- Packe den Code in [ code ] -Tags. Also auf Edit und dein Code mit den Button unter den Smylies ein/aus klicken.

- Sage uns in welcher Zeile der Fehler kommt. Dazu beim starten des Code zuvor den Debugger einschalten, der sagt dir dann wo der Fehler kommt.
Download der Draw3D2 V.1.1 für schnelle Echtzeiteffekte über Blitz3D
 

Lador

BeitragMi, Jul 04, 2007 18:28
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi, also, ich denke ehrlichgesagt kaum, dass jemand diese hunderten Zeilen von Code durchlesen wird. Also: Suche dir den Code raus, bei dem du denkst, der Fehler passiert.

Reaper auf unrealsoftware.de hat Folgendes geschrieben:
das ist ein generelles problem von blitz basic programmen spielen und hauptsächlich ati grafikkarten. bei mir geht zum beispiel von der aktuellen version nur die -highquality version. ist halt ati style die billig grafiken braucht man net, ati hat genug power
 

Fantomas

BeitragMi, Jul 04, 2007 19:26
Antworten mit Zitat
Benutzer-Profile anzeigen
Das Problem ist das es keine Fehlermeldung gibt beim debugger.und ich kann es ja eigentlich auch spielen.aber sobald es auf ein anderen pc ist das spiel geht es nur ne weile und dann kommt der fehler.daher weiss ich auch nicht wo fer fehler genau ist ( bin leider noch ein noob).habe nun die farbtiefe auf 32 gesetzt und dann kommt der fehler auch bei mir und im debugger zeigt er mir die zeile an "siehe fast ganz unten" bei ;-------Kollision geist vorne rechts-------
ausklappen dann sieht mans.hab ";Diese Zeile ist wohl falsch" da hin geschrieben



Code: [AUSKLAPPEN]
;----------Voreinstellungen------------
Graphics 800,600,16,1
AppTitle "MoorGhost"
Global frametimer = CreateTimer(50)
SetBuffer BackBuffer()
SeedRnd MilliSecs()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;---------Variablen--------------------
start_button = LoadImage("start_button.png")
MaskImage start_button,255,0,255
Global layer1 = LoadImage("schloss.JPG")
Global layer2 = LoadImage("layer2.png")
MaskImage layer2,255,0,255
Global layer3 = LoadImage("layer3.png")
MaskImage layer3,255,0,255
Global geisthl = LoadAnimImage("geistanimalphahl.png",25,25,0,7)
MaskImage geisthl,255,0,255
Global geistml = LoadAnimImage("geistanimalphaml.png",50,50,0,7)
MaskImage geistml,255,0,255
Global geistvl = LoadAnimImage("geistanimalphavl.png",100,100,0,7)
MaskImage geistvl,255,0,255
;;;geister rechts;;;;;;;;;;;
Global geisthr = LoadAnimImage("geistanimalphahl.png",25,25,0,7)
MaskImage geisthr,255,0,255
Global geistmr = LoadAnimImage("geistanimalphaml.png",50,50,0,7)
MaskImage geistmr,255,0,255
Global geistvr = LoadAnimImage("geistanimalphavl.png",100,100,0,7)
MaskImage geistvr,255,0,255
Global fadenkreuz = LoadImage("fadenkreuz.png")
MaskImage fadenkreuz,255,0,255
MidHandle fadenkreuz
Global start = 0
Global MH1 = MouseHit(1)
Global MH2 = MouseHit(2)
Global punkte
Global anim
Global maus_pos_x
Global maus_pos_y
Global layer1_pos_x
Global layer2_pos_x
Global layer3_pos_x
Global ghlposx
Global ghrposx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;------zubehör Regen-----------------
Dim X1(100), Y1(100), V1(100)
For i=0 To 100
X1(i)=Rand(0,799)
Y1(i)=Rand(0,599)
V1(i)=Rand(1,10)
Next
Function regen()
For i=0 To 100
Y1(i)=Y1(i)+V1(i)
If Y1(i)>599 Then Y1(i)=0: V1(i)=Rand(1,10)
Color 255,0,255
Plot X1(i),Y1(i)
Color 255,255,255
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;----------Types-----------------------

Type geisthl
Field ghlposx
Field ghlposy
End Type
;-----------
Type geistml
Field gmlposx
Field gmlposy
End Type
;------------
Type geistvl
Field gvlposx
Field gvlposy
End Type
;-----------
Global infohl.geisthl
Global infoml.geistml
Global infovl.geistvl

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;types rechts geister;;;;;;;;;;;;
Type geisthr
Field ghrposx
Field ghrposy
End Type
;-----------
Type geistmr
Field gmrposx
Field gmrposy
End Type
;------------
Type geistvr
Field gvrposx
Field gvrposy
End Type
;-----------
Global infohr.geisthr
Global infomr.geistmr
Global infovr.geistvr
;----------Menue-----------------------


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

geisthrf()
geistmrf()
geistvrf()

geisthlf()
geistmlf()
geistvlf()
;--------Hauptprogramm-----------------
Repeat
For anim = 0 To 6
WaitTimer frametimer
layer1()
geisthlc()
geistmlc()
geistvlc()
geisthldraw()
geistmldraw()
geistvldraw()
;rechtsgeister
geisthrc()
geistmrc()
geistvrc()
geisthrdraw()
geistmrdraw()
geistvrdraw()
layer2()
layer3()
punkte()
regen()
maus()
Flip
Cls
Next
Until KeyHit(1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




;----------Functionen------------------
;----------Layer1----------------------
Function layer1()
TileImage layer1, layer1_pos_x, y
If KeyDown(203) Or maus_pos_x < 50 Then
layer1_pos_x = (layer1_pos_x + 2)
For infohl.geisthl = Each geisthl
If layer1_pos_x < 0
infohl\ghlposx = infohl\ghlposx + Rnd(0.1,1) + 2
EndIf
Next
For infohr.geisthr = Each geisthr
If layer1_pos_x < 0
infohr\ghrposx = infohr\ghrposx - Rnd(0.1,4) + 6
EndIf
Next
ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
layer1_pos_x = layer1_pos_x - 2
For infohl.geisthl = Each geisthl
If layer1_pos_x > -400
infohl\ghlposx = infohl\ghlposx + Rnd(0.1,1) - 4
EndIf
Next
For infohr.geisthr = Each geisthr
If layer1_pos_x > -400
infohr\ghrposx = infohr\ghrposx - Rnd(0.1,4) - 2
EndIf
Next
EndIf
If layer1_pos_x > 0 Then layer1_pos_x = 0
If layer1_pos_x < -400 Then layer1_pos_x = -400
End Function

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




;------------Layer2--------------------
Function layer2()
DrawImage layer2,layer2_pos_x,y
If KeyDown(203) = 1 Or maus_pos_x < 50 Then
layer2_pos_x = layer2_pos_x + 4
For infoml.geistml = Each geistml
If layer2_pos_x < 0
infoml\gmlposx = infoml\gmlposx + Rnd(0.1,2) + 4
EndIf
Next
For infomr.geistmr = Each geistmr
If layer2_pos_x < 0
infomr\gmrposx = infomr\gmrposx - Rnd(0.1,4) + 6
EndIf
Next
ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
layer2_pos_x = layer2_pos_x - 4
For infoml.geistml = Each geistml
If layer2_pos_x > -800
infoml\gmlposx = infoml\gmlposx + Rnd(0.1,2) - 6
EndIf
Next
For infomr.geistmr = Each geistmr
If layer2_pos_x > -800
infomr\gmrposx = infomr\gmrposx - Rnd(0.1,4) - 4
EndIf
Next
EndIf
If layer2_pos_x > 0 Then layer2_pos_x = 0
If layer2_pos_x < -800 Then layer2_pos_x = -800
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-----------Layer3----------------------
Function layer3()
DrawImage layer3,layer3_pos_x,y
If KeyDown(203) = 1 Or maus_pos_x < 50 Then
layer3_pos_x = layer3_pos_x + 8
For infovl.geistvl = Each geistvl
If layer3_pos_x < 0
infovl\gvlposx = infovl\gvlposx + Rnd(0.1,1) + 8
EndIf
Next
For infovr.geistvr = Each geistvr
If layer3_pos_x < 0
infovr\gvrposx = infovr\gvrposx - Rnd(0.1,4) + 10
EndIf
Next
ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
layer3_pos_x = layer3_pos_x - 8
For infovl.geistvl = Each geistvl
If layer3_pos_x > -1600
infovl\gvlposx = infovl\gvlposx + Rnd(0.1,1) - 10
EndIf
Next
For infovr.geistvr = Each geistvr
If layer3_pos_x > -1600
infovr\gvrposx = infovr\gvrposx - Rnd(0.1,4) - 8
EndIf
Next
EndIf
If layer3_pos_x > 0 Then layer3_pos_x = 0
If layer3_pos_x < -1600 Then layer3_pos_x = -1600
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;---------geist hinten links-------------
Function geisthlf()
If Last geisthl = Null Then
v = Rnd(1,4)
EndIf
For i = 1 To v
infohl.geisthl = New geisthl
infohl\ghlposx = Rnd(-1000,0)
infohl\ghlposy = Rnd(50,500)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;----------geist mitte links--------------
Function geistmlf()
If Last geistml = Null Then
v = Rnd(1,3)
For i = 1 To v
infoml.geistml = New geistml
infoml\gmlposx = Rnd(-100,0)
infoml\gmlposy = Rnd(50,500)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne links---------------
Function geistvlf()
If Last geistvl = Null Then
v = Rnd(1,5)
For i = 1 To v
infovl.geistvl = New geistvl
infovl\gvlposx = Rnd(-1000,0)
infovl\gvlposy = Rnd(50,400)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;--------geist hinten links zeichnen------
Function geisthldraw()
For infohl.geisthl = Each geisthl
DrawImage geisthl, infohl\ghlposx, infohl\ghlposy,anim
infohl\ghlposx = infohl\ghlposx + Rnd(0.1,1)
infohl\ghlposy = infohl\ghlposy + Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist mitte links zeichnen-------
Function geistmldraw()
For infoml.geistml = Each geistml
DrawImage geistml, infoml\gmlposx, infoml\gmlposy,anim
infoml\gmlposy = infoml\gmlposy + Rnd(-5,5)
infoml\gmlposx = infoml\gmlposx + Rnd(0.1,2)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne links zeichnen-------
Function geistvldraw()
For infovl.geistvl = Each geistvl
DrawImage geistvl, infovl\gvlposx, infovl\gvlposy,anim
infovl\gvlposx = infovl\gvlposx + Rnd(0.1,4)
infovl\gvlposy = infovl\gvlposy + Rnd(0.1,1)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-------Kollision geist hinten links-------
Function geisthlc()
For infohl.geisthl = Each geisthl
If MH1 And ImagesCollide(geisthl, infohl\ghlposx, infohl\ghlposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infohl.geisthl
punkte = punkte + 1
geisthlf()
ElseIf infohl\ghlposx >800 Then
Delete infohl.geisthl
geisthlf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist mitte links-------
Function geistmlc()
For infoml.geistml = Each geistml
If MH1 And ImagesCollide(geistml, infoml\gmlposx, infoml\gmlposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infoml.geistml
punkte = punkte + 1
geistmlf()
ElseIf infoml\gmlposx >800 Then
Delete infoml.geistml
geistmlf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist vorne links-------
Function geistvlc()
For infovl.geistvl = Each geistvl
If MH1 And ImagesCollide(geistvl, infovl\gvlposx, infovl\gvlposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infovl.geistvl
punkte = punkte + 1
geistvlf()
ElseIf infovl\gvlposx >800 Then
Delete infovl.geistvl
geistvlf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;---------Punktestand-----------------------
Function punkte()
Text 600,550, "Punkte : " + punkte
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Geister rechts;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist hinten rechts-------------
Function geisthrf()
If Last geisthr = Null Then
v = Rnd(1,4)
EndIf
For i = 1 To v
infohr.geisthr = New geisthr
infohr\ghrposx = Rnd(1800,800)
infohr\ghrposy = Rnd(50,500)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;----------geist mitte rechts--------------
Function geistmrf()
If Last geistmr = Null Then
v = Rnd(1,3)
For i = 1 To v
infomr.geistmr = New geistmr
infomr\gmrposx = Rnd(1800,800)
infomr\gmrposy = Rnd(50,500)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne rechts---------------
Function geistvrf()
If Last geistvr = Null Then
v = Rnd(1,2)
For i = 1 To v
infovr.geistvr = New geistvr
infovr\gvrposx = Rnd(1800,800)
infovr\gvrposy = Rnd(50,500)
Next
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;--------geist hinten rechts zeichnen------
Function geisthrdraw()
For infohr.geisthr = Each geisthr
DrawImage geisthr, infohr\ghrposx, infohr\ghrposy,anim
infohr\ghrposx = (infohr\ghrposx - Rnd(0.1,2))
infohr\ghrposy = infohr\ghrposy - Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist mitte rechts zeichnen-------
Function geistmrdraw()
For infomr.geistmr = Each geistmr
DrawImage geistmr, infomr\gmrposx, infomr\gmrposy,anim
infomr\gmrposx = infomr\gmrposx - Rnd(0.1,4)
infomr\gmrposy = infomr\gmrposy - Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;---------geist vorne rechts zeichnen-------
Function geistvrdraw()
For infovr.geistvr = Each geistvr
DrawImage geistvr, infovr\gvrposx, infovr\gvrposy,anim
infovr\gvrposx = infovr\gvrposx - Rnd(0.1,8)
infovr\gvrposy = infovr\gvrposy - Rnd(-5,5)
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-------Kollision geist hinten rechts-------
Function geisthrc()
For infohr.geisthr = Each geisthr
If MH1 And ImagesCollide(geisthr, infohr\ghrposx, infohr\ghrposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infohr.geisthr
punkte = punkte + 1
geisthrf()
ElseIf infohr\ghrposx =< 0 Then
Delete infohr.geisthr
geisthrf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist mitte rechts-------
Function geistmrc()
For infomr.geistmr = Each geistmr
If MH1 And ImagesCollide(geistmr, infomr\gmrposx, infomr\gmrposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then
Delete infomr.geistmr
punkte = punkte + 1
geistmrf()
ElseIf infomr\gmrposx =< 0 Then
Delete infomr.geistmr
geistmrf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------Kollision geist vorne rechts-------
Function geistvrc()
For infovr.geistvr = Each geistvr
If MH1 And ImagesCollide(geistvr, infovr\gvrposx, infovr\gvrposy,anim, fadenkreuz,maus_pos_x ,maus_pos_y ,0) Then    ;Diese Zeile ist wohl falsch
Delete infovr.geistvr
punkte = punkte + 1
geistvrf()
ElseIf infovr\gvrposx =< 0 Then
Delete infovr.geistvr
geistvrf()
punkte = punkte - 1
EndIf
Next
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;-------------Maus------------------------
Function maus()
If MouseHit(1) Then MH1 = True Else MH1 = False
maus_pos_x = MouseX()
maus_pos_y = MouseY()
DrawImage fadenkreuz,maus_pos_x ,maus_pos_y
End Function
[/code]

Rone

BeitragMi, Jul 04, 2007 19:54
Antworten mit Zitat
Benutzer-Profile anzeigen
schon mal was von einrücken gehört?
 

Fantomas

Betreff: einrücken??

BeitragMi, Jul 04, 2007 20:01
Antworten mit Zitat
Benutzer-Profile anzeigen
ne .weiss nicht was du meinst mit einrücken.wie gesagt progge erst seit 06.2007 also totalnoob.habe aber den fehler anscheinend gefunden. obwohl die geistergrafik die grösse von 800x100 hat und somit 8 animationen a 100x100 machen könnte geht nur 99x99 also
Global geistvr = LoadAnimImage("geistanimalphavl.png",99,99,0,7)
und nicht wie vorher
Global geistvr = LoadAnimImage("geistanimalphavl.png",100,100,0,7)

Rone

BeitragMi, Jul 04, 2007 20:07
Antworten mit Zitat
Benutzer-Profile anzeigen
ich meine sowas:
Code: [AUSKLAPPEN]

Function layer3()

   DrawImage layer3,layer3_pos_x,y
   
   If KeyDown(203) = 1 Or maus_pos_x < 50 Then
   
      layer3_pos_x = layer3_pos_x + 8
      
      For infovl.geistvl = Each geistvl
         If layer3_pos_x < 0
            infovl\gvlposx = infovl\gvlposx + Rnd(0.1,1) + 8
         EndIf
      Next
      
      For infovr.geistvr = Each geistvr
         If layer3_pos_x < 0
            infovr\gvrposx = infovr\gvrposx - Rnd(0.1,4) + 10
         EndIf
      Next
      
   ElseIf KeyDown(205) = 1 Or maus_pos_x > 750 Then
   
      layer3_pos_x = layer3_pos_x - 8
      
      For infovl.geistvl = Each geistvl
         If layer3_pos_x > -1600
            infovl\gvlposx = infovl\gvlposx + Rnd(0.1,1) - 10
         EndIf
      Next
      
      For infovr.geistvr = Each geistvr
         If layer3_pos_x > -1600
            infovr\gvrposx = infovr\gvrposx - Rnd(0.1,4) - 8
         EndIf
      Next
   EndIf
   
   If layer3_pos_x > 0 Then layer3_pos_x = 0
   If layer3_pos_x < -1600 Then layer3_pos_x = -1600

End Function


...sieht doch gleich viel übersichtlicher aus.
 

Fantomas

BeitragMi, Jul 04, 2007 20:11
Antworten mit Zitat
Benutzer-Profile anzeigen
achso.stimmt.mache ich nexte mal Smile
is nen langer weg zum profi
Vielen Dank für die Antworten

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group