Nah, it has the same problem as the last which leads me to believe that the problem is elsewhere. Basically my platform character is getting stuck in tiles sometimes when jumping, especially diagonal movement. I'll post the code here incase anyone can shed some light.
// Project: TrapDodge
// Created: 19-04-05
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle("TrapDodge")
SetWindowSize(1024, 768, 0)
SetWindowAllowResize(1) // allow the user to resize the window
// set display properties
SetVirtualResolution(1024, 768) // doesn't have to match the window
SetOrientationAllowed(1, 1, 1, 1) // allow both portrait and landscape on mobile devices
SetSyncRate(60, 0) // 30fps instead of 60 to save battery
SetScissor(0, 0, 0, 0) // use the maximum available screen space, no black borders
UseNewDefaultFonts(1)
#insert "constants.agc"
#insert "Game.scene"
img_Dave = LoadImage( "dave.png" )
spr_Dave = CreateSprite(img_Dave)
SetSpriteAnimation(spr_Dave, 32, 32, 12)
img_GPman = LoadImage( "GPman.png" )
global hspeed as float = 0
global vspeed as float = 0
global WalkSpeed as float = 3
global Gravity as float = 0.3
global Move as integer
global KeyLeft as integer
global KeyRight as integer
global KeyJump as integer
global Player as integer
global PlayerX as float
global PlayerY as float
PlayerX = 0
PlayerY = GetVirtualHeight() - 128
global DaveStateR as integer = 0
global DaveStateL as integer = 0
Game_setup()
type Zoik
id as integer
sprite as integer
x as float
y as float
move as integer
hspeed as float
vspeed as float
gravity as float
state as integer
endtype
global ZoikList as Zoik[]
for x = 0 to Game_Zoiks.length
local z as Zoik
z.state = Random(0,1)
z.sprite = CreateSprite(img_GPman)
SetSpriteAnimation(z.sprite, 26, 32, 19)
if z.state = 0
SetSpriteFlip(z.sprite, 1, 0)
elseif z.state = 1
SetSpriteFlip(z.sprite, 0, 0)
endif
PlaySprite(z.sprite, 15)
z.x = GetSpriteX(Game_Zoiks[x])
z.y = GetSpriteY(Game_Zoiks[x])
ZoikList.insert(z)
next
for x = 0 to ZoikList.length
SetSpritePosition(ZoikList[x].sprite, ZoikList[x].x, ZoikList[x].y)
next
for x = Game_Zoiks.length to 0 step - 1
DeleteSprite(Game_Zoiks[x])
next
Game_Zoiks.length = -1
do
KeyLeft = GetRawKeyState(KEY_LEFT)
KeyRight = GetRawKeyState(KEY_RIGHT)
KeyJump = GetRawKeyState(KEY_CONTROL)
Move = KeyRight - KeyLeft
hspeed = Move * WalkSpeed
vspeed = vspeed + Gravity
// Dave State Going Right
if hspeed = 0 and Move = 0
if DaveStateR = 0
PlaySprite(spr_Dave, 8, 1, 7, 10 )
DaveStateR = -1
endif
elseif hspeed > 0 and Move = 1
if DaveStateR = -1
SetSpriteFlip(spr_Dave, 0, 0)
PlaySprite(spr_Dave, 12, 1, 1, 6)
DaveStateR = 0
endif
endif
//Dave State Going Left
if hspeed = 0 and Move = 0
if DaveStateL = 0
PlaySprite(spr_Dave, 8, 1, 7, 10 )
DaveStateL = -1
endif
elseif hspeed < 0 and Move = -1
if DaveStateL = -1
SetSpriteFlip(spr_Dave, 1, 0)
PlaySprite(spr_Dave, 12, 1, 1, 6)
DaveStateL = 0
endif
endif
for x = 0 to Game_CubeArray.length
if RectsOverlap(PlayerX, PlayerY+1, 30, 32, GetSpriteX(Game_CubeArray[x]), GetSpriteY(Game_CubeArray[x]), 32, 32) = 1 and KeyJump = 1
vspeed = -6.5
endif
//Horizontal Collision
if RectsOverlap(PlayerX+hspeed,PlayerY, 30, 32, GetSpriteX(Game_CubeArray[x]), GetSpriteY(Game_CubeArray[x]), 32, 32) = 1
while not RectsOverlap(PlayerX+sin(hspeed),PlayerY, 30, 32, GetSpriteX(Game_CubeArray[x]), GetSpriteY(Game_CubeArray[x]), 32, 32)
PlayerX = PlayerX + sin(hspeed)
endwhile
hspeed = 0
endif
//Vertical Collision
if RectsOverlap(PlayerX, PlayerY+vspeed, 30, 32, GetSpriteX(Game_CubeArray[x]), GetSpriteY(Game_CubeArray[x]), 32, 32) = 1
while not RectsOverlap(PlayerX, PlayerY+sin(vspeed), 30, 32, GetSpriteX(Game_CubeArray[x]), GetSpriteY(Game_CubeArray[x]), 32, 32)
PlayerY = PlayerY + sin(vspeed)
endwhile
vspeed = 0
endif
//Zoik Updates
next
PlayerX = PlayerX + hspeed
PlayerY = PlayerY + vspeed
if ZoikList.length > -1
for x = ZoikList.length to 0 step - 1
if ZoikList[x].state = 0
ZoikList[x].x = ZoikList[x].x - 0.5
elseif ZoikList[x].state = 1
ZoikList[x].x = ZoikList[x].x - 0.5
endif
SetSpritePosition(ZoikList[x].sprite, ZoikList[x].x, ZoikList[x].y)
next
endif
SetSpritePosition(spr_Dave, PlayerX, PlayerY)
Game_sync()
Sync()
loop
function RectsOverlap(x1, y1, w1, h1, x2, y2, w2, h2)
If x1 >= x2 + w2 Then exitfunction 0
If x2 >= x1 + w1 Then exitfunction 0
If y1 >= y2 + h2 Then exitfunction 0
If y2 >= y1 + h1 Then exitfunction 0
endfunction 1
Win 10 Pro - AMD RYZEN 7 Octacore 3.8ghz - 32GB DDR4 - RTX 2070 8GB