Hi all.
Having issues with jumping. Currently using the command:
if getspritehittest(aJumpSpr,screentoworldx(GetPointerX()),screentoworldy(GetPointerY())) and GetPointerState()=1
SetSpritePhysicsVelocity(1,0,-400) //Jump fly
endif
When i press the Up arrow sprite, the sprite moves up, then when i let go, it drops back down. Now, i want the sprite to JUMP, not FLY. I.e. when i press the up arrow, regardless of how many times i press it, it won't jump again until it hits the floor. Now, i've read the following post:
http://forum.thegamecreators.com/?m=forum_view&t=212989&b=41
And a moderator suggested doing the following:
You could check for collision below the players usual Y position. Like, make a floor from sprites with collision enabled, add platforms too of course, and get your collision working with that, even if there is no working jump function. Ideally, you'd be able to start the player on top of a platform, and make sure they can walk left and right and drop down to the floor.
Now, i have a sprite, let's call it spriteA, which gives a 1 when SpriteB is ontop of it, so far so good. But i made an array to copy the block multiply times and lay it, via:
type grassLand
spriteImg as integer
spriteId as integer
spriteOn as integer
endtype
Global grass as grassLand[30]
Global grassSlope as grassland[4]
function buildLand()
grassSlopeImg = LoadImage("land/grass/slice07_07.png")
grassSlopeSpr = CreateSprite(grassSlopeImg)
setspritephysicsOn(grassSlopeSpr, 1) // Physics On!
//Landsprites
grassImg = LoadImage("land/grass/slice03_03.png")
grassSpr = CreateSprite(grassImg)
SetSpritePosition(grassSpr, 0, sH -GetSpriteHeight(grassSpr)*3)
setspritephysicsOn(grassSpr, 1) // Physics On!
for i = 1 to grass.length
grass[i].spriteImg = LoadImage("land/grass/slice03_03.png")
grass[i].spriteId = CreateSprite(grass[i].spriteImg)
setspritephysicson(grass[i].spriteId,1)
next
SetSpritePosition(grass[1].spriteId, getspritex(grassSpr) + GetSpriteWidth(grassSpr),sH - GetSpriteHeight(grassSpr)*3)
for i = 2 to grass.length
SetSpritePosition(grass[i].spriteId, getspritex(grass[i-1].spriteId) + GetSpriteWidth(grass[i-1].spriteId), sH - GetSpriteHeight(grass[i-1].spriteId)*3)
SetSpritePosition(grassSlopeSpr, getspritex(grass[i].spriteId) + GetSpriteWidth(grass[i].spriteId), sH - GetSpriteHeight(grass[i].spriteId) *4)
next
endfunction
What is the new sprite called? GetSpriteCollision(spritA, ???) I've tried everything lol
Khadin