Quote: "If you're going for a faster falling effect, maybe crank up the gravity value instead of a force on the pieces."
What I was trying to do, was allow it to move Left/Right while maintaining the pull in the Y direction from gravity.
I solved my problem! Turns out I had a stupid logic error....... It's one of those things that wasn't easy to find, but when you do you're like "WTF was I thinking?" I found it by reviewing my code from previous projects. That's when I found the below code from my first program. I tested it, and noticed the behavior was different even though the code was mostly the same. An excerpt from my code is below. I'd provide an example of the actual problem, but it is really embarrassing.
type Entity
sprite as integer
entityType as string //Type of Entity.
debugName as string //Name used for debugging. Sometimes IDs aren't enough for me.
faceing as string
idle as integer //Use as boolean.
forceX as float
forceY as float
damping as float
jumping as integer //Use as boolean to denote if a jump is being sustained. TODO CH NOT SURE IF I LIKE THIS MECHANISM.
health as float
damage as float
dead as integer //Use as boolean.
imgFilePath as string
img as integer
endtype
function Player_Control_KeyBoard(player ref as Entity)
player.forceX = 0
jumpUpMaxVel = -50
maxJumpTime = 3.00
player.idle = TRUE
fX = 400
//Move WEST
if (GetRawKeyPressed(KEY_A))
player.idle = FALSE
player.faceing = WEST
player.forceX = 0 - fX
SetSpritePhysicsImpulse(player.sprite, GetSpriteXByOffset(player.sprite), GetSpriteYByOffset(player.sprite), player.forceX, player.forceY)
elseif (GetRawKeyState(KEY_A))
player.idle = FALSE
player.faceing = WEST
player.forceX = 0 - fX
endif
//MOVE EAST
if (GetRawKeyPressed(KEY_D))
player.idle = FALSE
player.faceing = EAST
player.forceX = fX
SetSpritePhysicsImpulse(player.sprite, GetSpriteXByOffset(player.sprite), GetSpriteYByOffset(player.sprite), player.forceX, player.forceY)
elseif (GetRawKeyState(KEY_D))
player.idle = FALSE
player.faceing = EAST
player.forceX = fX
endif
//Jumping
if (GetRawKeyPressed(KEY_W))
player.idle = FALSE
player.forceY = -10000
SetSpritePhysicsImpulse(player.sprite, GetSpriteXByOffset(player.sprite), GetSpriteYByOffset(player.sprite), player.forceX, player.forceY)
else
player.forceY = 0
endif
//Nothing pressed/IDLE
if (player.idle)
//Does nothing for now, but leaving the IFELSE like this because reasons.
else
SetSpritePhysicsForce(player.sprite, GetSpriteXByOffset(player.sprite), GetSpriteYByOffset(player.sprite), player.forceX, player.forceY)
endif
if(GetRawKeyPressed(KEY_Z))
SetSpritePositionByOffset(player.sprite, 200, 200)
endif
endfunction
Thanks, for the help! In all actuality you guys helped me a ton simply by allowing me to brainstorm off of your suggestions which lead me to remember about the first program I made with AGK2.
-mrradd-