Hi guys,
I am an indie game maker, and I have made 2 mobile games using corona SDK (Pixelpartyapps.com)
The guy who wrote the code for me, is no longer available for helping with it, so I wonder if someone here can help me as it seem like a small issue to solve
The game is an endless run & jumper.
The character runs through the platforms, the left side of the screen is the jump button, and the right is the hit button which is used to neutralize enemies.
My main problem is that once in a while, when I use jump and hit together, the jump button stop reacting.
It can happen when I press them simultaneously, or just one after another.
For those who are interested in downloading the game to get a better feel, here are the links to both stores:
Android: https://play.google.com/store/apps/details?id=com.gmail.asafgibor.Asaf_Runner
iPhone: https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1102182242&mt=8
It might take couple of tries to experience it, but (unfortunately) it happens, pretty random, but happens…
Here is the collision part of the code:
function character:collision(event) if event.phase == "began" then if event.other.id == "block" then if self.contentBounds.xMax \<= event.other.contentBounds.xMin then self.isJumpPossible = 0; self.isJumpPressed = false; elseif self.contentBounds.yMax \<= event.other.contentBounds.yMin then self.isJumpPossible = 1+canSecondJump; self.firstJump = true; if self.sequence ~= "run" and not self.isHitting then self:setSequence("run"); self:play(); end end elseif event.other.id == "coin" then --audio.play(powerUpSFX, {channel = audio.findFreeChannel()}); event.other.hasTouchedCharacter = true; elseif event.other.id == "heart" then audio.play(powerUpSFX, {channel = audio.findFreeChannel()}); event.other.hasTouchedCharacter = true; elseif event.other.id == "invincibility" then audio.play(powerUpSFX, {channel = audio.findFreeChannel()}); event.other.hasTouchedCharacter = true; self.isDamaged = invincibilityTime; elseif event.other.id == "enemy" then if not self.isHitting then if (self.contentBounds.yMax) \<= (event.other.contentBounds.yMin+6) then audio.play(jumpEnemySFX, {channel = audio.findFreeChannel()}); if event.other.name == "purpleEnemy" then event.other:setLinearVelocity(0, 200); end if self.isJumpPressed then audio.play(jumpSFX, { channel = audio.findFreeChannel() }); self:setLinearVelocity(gameSpeed, -jumpPower); self.activateJump = true; self.maxJump = character.y-maxJumpOffset; if not self.isHitting then self:setSequence("jump"); self:play(); end self.isJumpPressed = true; else self:setLinearVelocity(gameSpeed, -jumpPower); end else if self.isDamaged \<= 0 then audio.play(hitByEnemySFX, {channel = audio.findFreeChannel()}); currentLifes = mMax(0, currentLifes-event.other.damage); self.isDamaged = 120; end end else event.other.isDamaged = 120; end end elseif event.phase == "ended" then if event.other.id == "block" then --self.firstJump = nil; --self.isJumpPossible = self.isJumpPossible-1; end end end
I’d appreciate any help, and if there is any other info needed, let me know, and I will post.
Thanks!
Asaf