Ok, now I have trouble changing backgrounds; I'm having trouble finding out the appropriate command to help change backgrounds when my character EATUM eats the pancakes (the pancakes is like a door to another place). I wrote about the problem at the bottom of this code:
Graphics 900, 900
SetBuffer BackBuffer()
EATUM = LoadImage ("Eatum.png")
APPLE = LoadImage("Apple.png")
ORBE = LoadImage("Orbe.png")
DOOR = LoadImage("Door.png")
PANCAKES = LoadImage("Pancakes.png")
BACKGROUND = LoadImage("Clouds.jpg")
BACKGROUND2 = LoadImage("backgroundtree.jpg")
BACKGROUND3 = LoadImage("background3.jpg")
Type EATUM
Field x,y
End Type
Type APPLE
Field x,y
End Type
Type ORBE
Field x,y
End Type
Type DOOR
Field x,y
End Type
Type PANCAKES
Field x,y
End Type
Type BACKGROUND
Field x,y
End Type
Type BACKGROUND2
Field x,y
End Type
Type BACKGROUND3
Field x,y
End Type
e.EATUM = New EATUM
e\x = 70
e\y = 200
For z = 1 To 5
a.Apple = New Apple
a\x = 100+30*z
a\y = 90*z
Next
o.ORBE = New ORBE
o\x = 100
o\y = -200
d.DOOR = New DOOR
d\x = 50
d\y = 50
p.PANCAKES = New PANCAKES
p\x = 80
p\y = 80
b.BACKGROUND = New BACKGROUND
b\x = 100
b\y = 100
b2.BACKGROUND2 = New BACKGROUND2
b2\x = 150
b2\y = 150
b3.BACKGROUND3 = New BACKGROUND3
b3\x = 130
b3\y = 130
Score = 0
While Not KeyDown (1)
Cls
TileImage (BACKGROUND,b\x,b\y)
DrawImage (EATUM,e\x,e\y)
For a.APPLE = Each APPLE
DrawImage(APPLE,a\x,a\y)
If ImagesCollide(EATUM,e\x,e\y,0,APPLE,a\x,a\y,0) Delete a score = score + 1
Next
Text 150,90, "Score" + Score
If KeyDown(203)
e\x = e\x - 3
b\x = b\x + 3
b2\x = b2\x + 3
If (o <> Null) Then
If ImagesCollide(EATUM,e\x,e\y,0,ORBE,o\x,o\y,0)
o\x = o\x - 3
EndIf
EndIf
EndIf
If KeyDown(205)
e\x = e\x + 3
b\x = b\x - 3
b2\x = b2\x - 3
If (o <> Null) Then
If ImagesCollide (EATUM,e\x,e\y,0,ORBE,o\x,o\y,0)
o\x = o\x + 3
EndIf
EndIf
EndIf
If KeyDown(200)
e\y = e\y - 3
If (o <> Null) Then
If ImagesCollide(EATUM,e\x,e\y,0,ORBE,o\x,o\y,0)
o\y = o\y - 3
EndIf
EndIf
EndIf
If KeyDown(208)
e\y = e\y + 3
If (o <> Null) Then
If ImagesCollide(EATUM,e\x,e\y,0,ORBE,o\x,o\y,0)
o\y = o\y + 3
EndIf
EndIf
EndIf
DrawImage (DOOR,d\x,d\y)
If (o <> Null) Then
DrawImage (ORBE,o\x,o\y)
If ImagesCollide(DOOR,d\x,d\y,0,ORBE,o\x,o\y,0)
Delete o
score = score + 1
EndIf
Else
Text 350,300, "Great Job"
Cls
TileImage(BACKGROUND2,b2\x,b2\y)
;here at the DrawImage part is the problem. I'm trying to make my pancakes be the door to BACKGROUND3 after EATUM collides with the plate
;but I don't know what command to use to do that with. It seems like it might be something very simple.
DrawImage (PANCAKES,p\x,p\y)
If ImagesCollide (EATUM, e\x,e\y,0,PANCAKES,p\x,p\y,0) Then
Delete p
TileImage (BACKGROUND3,b3\x,b3\y)
EndIf
EndIf
DrawImage (EATUM,e\x,e\y)
Flip
Wend
|