Hi
Quote: "GetSpriteTopCollision()"
I guess you could do it by yourself.
A quick example for GetSpriteTop() and GetSpriteBottom() :
// Project: GetSpriteTop() & GetSpriteBottom()
// Created: 2016-07-04
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "GetSpriteTop & GetSpriteBottom" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
Type tSprite
sprite as integer
x as integer
y as integer
w as integer
h as integer
Endtype
Global dim Sprite[1] as tSprite
CreateNewSprite(0,0,50,50,-1,-1) // create the first sprite at 50,50
CreateNewSprite(1,0,0,500,1000,20) // create the floor at 0,500 and change it size by 1000*20
x=50
y=50
speed=4
do
Print( ScreenFPS() )
Print(str(GetspriteBottom(0))+"/"+str(GetSpriteTop(1)))
Print(str(y)+"/"+str(Sprite[0].y))
if GetRawKeyState(39)
x=x+speed
endif
if GetRawKeyState(37)
x=x-speed
endif
if GetRawKeyState(40)
if y < GetspriteTOp(1) - Sprite[0].h // - speed
y = y + speed
endif
endif
if GetRawKeyState(38)
y = y - speed
endif
//If GetspriteBottom(0)<GetSpriteTop(1) or y<=Sprite[0].y
SetSpritePosition(sprite[0].sprite,x,y)
Sprite[0].x = x
Sprite[0].y = y
//else
//SetSpritePosition(sprite[0].sprite,x,Sprite[0].y )
//Sprite[0].x = x
//endif
Sync()
loop
Function CreateNewSprite(id,img,x,y,w,h)
// the id of the sprite
if id=-1 // create the sprite dynamically
i = sprite.length+1
sprite.length = i
else // create the sprite by id
if id > sprite.length
sprite.length = id
endif
i = id
endif
//create the sprite
Sprite[i].sprite = CreateSprite(img)
//set the position
Sprite[i].x = x
Sprite[i].y = y
// set the size
if w=-1
Sprite[i].w = GetImageWidth(img)
if Sprite[i].w <=0
Sprite[i].w = 64
endif
w = sprite[i].w
else
sprite[i].w = w
endif
if h=-1
Sprite[i].h = GetImageheight(img)
if Sprite[i].h <=0
Sprite[i].h = 64
endif
h = sprite[i].h
else
sprite[i].h = h
endif
// set sprite position and size
SetSpritePosition(Sprite[i].sprite,x,y)
SetSpriteSize(sprite[i].sprite,w,h)
endfunction
Function GetspriteTop(id)
// top = Sprite[id].y // it's the same like the line :
top = GetSpriteY(sprite[id].sprite)
endfunction top
Function GetspriteBottom(id)
// bottom = Sprite[id].y + Sprite[id].h // it's the same like the line :
bottom = GetSpriteY(sprite[id].sprite)+ Sprite[id].h
EndFunction bottom
AGK2 tier1 - http://www.dracaena-studio.com