Below is a screenshot and code (with notes) on what I was trying to accomplish.
http://authorhenryemphrey.tripod.com/gallery/
Graphics 1640, 1000
SetBuffer BackBuffer ()
;----------------------------------------------------------------------------
;Load Items
HENRY = LoadAnimImage ("Move2.png",400,370,0,13)
ENEMY = LoadImage ("MintMonster.png")
DEFEATSOUND = LoadSound ("Punchsound.wav")
BACKGROUND = LoadImage ("DockII.jpg")
PLATFORM = LoadImage ("Big Platform2.png")
Type HENRY
Field x,y
Field frame
End Type
Type ENEMY
Field x,y
End Type
Type BACKGROUND
Field x,y
Field image
End Type
Type PLATFORM
Field x,y
End Type
h.HENRY = New HENRY
h\x = 600
h\y = 450
h\frame = 0
;there are two enemies
For j = 1 To 2
e.ENEMY = New ENEMY
e\x = 700 + (400*j)
e\y = 360
Next
b.BACKGROUND = New BACKGROUND
b\x = 0
b\y = 700
b\image = BACKGROUND
p.PLATFORM = New PLATFORM
p\x = 200
p\y = 370
MOVEMENT = 1
While Not KeyDown(1)
Cls
TileImage (b\image,b\x,b\y)
;here are the enemies that I'm trying to make the two collision effects with. With theses, I'm trying to make it so that
;if I collide with the enemies from the side HENRY dies, but if HENRY collides with the same ENEMY
;from the top, then the ENEMY dies, like Mario and the Goombas on Super Mario Bros.
For e.ENEMY = Each ENEMY
e\x = e\x + MOVEMENT
If e\x > 600 Then MOVEMENT = -MOVEMENT
If e\x < 800 Then MOVEMENT = 1
DrawImage (ENEMY,(b\x + e\x),e\y)
;Here's even more specifically what I'm trying to fix. Currently, this part doesn't have what I'm trying to accomplish.
If ImagesCollide (ENEMY,(b\x + e\x),e\y,0, HENRY,h\x,h\y,0) Then
Delete e
PlaySound (DEFEATSOUND)
EndIf
Next
DrawImage (HENRY,h\x,h\y,h\frame)
;draws the platform onto the screen
DrawImage (PLATFORM,(b\x + p\x),p\y)
;keeps the player on the platform
If ImagesCollide(HENRY,h\x,h\y,0,PLATFORM,(b\x + p\x),p\y,0) Then
h\y = 400
Else
h\y = h\y + 10
EndIf
;moves the player right
If KeyDown(205)
b\x = b\x - 5
h\frame = h\frame + 1
If h\frame > 2 Then
h\frame = 0
EndIf
EndIf
;moves the player left
If KeyDown(203)
b\x = b\x + 5
h\frame = h\frame + 1
If h\frame > 12 Then
h\frame = 6
EndIf
EndIf
;makes the player jump
If KeyDown (57)
h\y = h\y -150
EndIf
;brings the player back down to the ground after jumping
If Not KeyHit (57)
h\y = h\y + 10
EndIf
Flip
Wend
|