I'm going to start including screenshots of what I'm trying to do in my game. The screenshot is below. I'm still having trouble with fixing my game so that an ORBE can be pushed in the direction in which the player is going when the player gets to it. Thus in the URL below is a screenshot with an explanation of what I'm working on. Hopefully, it'll better illustrate where I'm at. I reckon that there might be something wrong with the way I wrote the code below. Hopefully I could figure out how to fix it with some help. Thanks
http://authorhenryemphrey.tripod.com/gallery/
Graphics 900, 900
SetBuffer BackBuffer()
;Loading images
EATUM = LoadImage ("Eatum.png")
ORBE = LoadImage("Orbe.png")
BACKGROUND = LoadImage("Clouds.jpg")
;Setting up the image types
Type EATUM
Field x,y
End Type
Type ORBE
Field x,y
End Type
Type BACKGROUND
Field x,y
Field image
End Type
;giving the images a shorter name and telling their locations
e.EATUM= New EATUM
e\x = 70
e\y = 200
o.ORBE = New ORBE
o\x = 100
o\y = -200
b.BACKGROUND = New BACKGROUND
b\x = -500
b\y = 20
b\image = BACKGROUND
While Not KeyDown (1)
Cls
TileImage (b\image,b\x,b\y)
;this moves the player to the left and if the player runs into the
;ORBE, the ORBE is supposed to be pushed to the left
If KeyDown(203)
b\x = b\x + 4
If (o <> Null) Then
If ImagesCollide(EATUM, e\x, e\y,0,ORBE, o\x, o\y,0) Then
o\x = o\x - 3
EndIf
EndIf
EndIf
;this moves the player to the right and if the player runs into the
;ORBE, the ORBE is supposed to be pushed to the rght
If KeyDown(205)
b\x = b\x - 4
If (o <> Null) Then
If ImagesCollide(EATUM,e\x,e\y,0,ORBE,o\x,o\y,0) Then
o\x = o\x + 3
EndIf
EndIf
EndIf
;Here's one of the problems that I've had. I was trying to make it
;so that when the player collides with the ORBE, the ORBE goes
;up when the player collides with it. But, the problem is that
;when the player goes up and gets to a certain proximity to the
;ORBE, the ORBE goes up at a time when the player HAS NOT
;collided with it. So thus, I was wondering what am I doing wrong
;here. Gosh, computers do some strange things...
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) Then
o\y = o\y - 3
EndIf
EndIf
EndIf
;this moves the player down and if the player runs into the ORBE
;while going down, the ORBE is supposedly to be pushed down.
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) Then
o\y = o\y + 3
EndIf
EndIf
EndIf
;here's where another problem lies. Here, I was trying to make it
;so that the player has to actually get to the ORBE in order
;to push it. But, it won't collide at all even though I put in
;the "ImagesCollide" command. And once again, when the player
;pushes the up button, when it gets to a certain PROXIMITY to
;the ORBE, the ORBE may moves up when the player HASN'T
;collided with it. Thus, how do I fix this. Thanks
If (o <> Null) Then
DrawImage (ORBE,(b\x + o\x),o\y)
EndIf
DrawImage (EATUM,e\x,e\y)
Flip
Wend
|