Works awesome... Until I build

Well hello again,

So I have nearly finished my first game. Been a long and stressful process to become a developer, but with the support behind Corona I wouldn’t want to be anywhere else!

But here is my problem. I have a level based game, using LevelHelper. When the player hits something, gameover. So I move to a gameover screen:

local function bottomCol(event)  
 if(event.phase == "began") then  
 audio.stop()  
 print("collision did happen on bottom")  
 storyboard.gotoScene( "gameOver2" )  
 elseif(event.phase == "ended") then  
 onBottom = false  
 shouldResetLevel = true  
 end  
 end  

And in the gameOver2 screen, you are prompted if you wish to try again, or go back to the menu.
If you press try again:

local function onTryTextRelease()  
  
storyboard.gotoScene( "GamePlay.level2", "fade", 200 )  
  
 return true   
end  

So that should work, right? In the Corona Simulator it does. It resets the level, and you can play again. No errors, nothing. But if I build for iOS or iOS Simulator, it doesn’t work. I press “Try again” and the text disappears, but nothing else. Is this a bug? I have the latest everything!

Second issue:

local function jump()  
 if onPlat then  
 box:applyLinearImpulse(0, impulseUp, box.x, box.y)  
 audio.play(jumpSound)  
 elseif onPlat == false then  
 end  
 end  

So that should be rather self-explanitory, user taps on button and impulseUp is a fixed value called, to maintain an equal impulse up.

if impulseUp \< -0.21 then  
 impulseUp = -0.21  
 end  

I called this, because sometimes it would jump REALLY high, or not at all. After putting this in, it works perfect.

Now here os the problem: iOS or iOS Simulator, it doesn’t work. It jumps maybe 1/4 of what it should. Why? I would change the value, but why? Is this an issue?

I hope someone can give me some answers, I am hoping to get it out there soon!

Ryley N [import]uid: 28237 topic_id: 34205 reply_id: 334205[/import]

Hello Ryley,
For case #1, typically this occurs if you have a case-sensitive mismatch in the module(s) or file(s) you’re trying to load. The Simulator isn’t picky about this, but the OS demands that it be the same. Check your file calls again and ensure that you’ve case-matched everything exactly in all instances. There might be something else going on, but check that first.

Case #2, where are you getting this impulse value? Is the body sometimes moving downward (falling) when you apply the impulse? Remember that applying an impulse in any direction will be negated by any velocity in the opposite direction… so if your character is falling and you apply an impulse, it probably won’t do much. If you need a more constant jump height, I suggest you experiment with applyLinearVelocity() instead, which sets a dedicated velocity while cancelling out any offsetting velocities.

Brent [import]uid: 200026 topic_id: 34205 reply_id: 136033[/import]

Hey,

For the first one, I am storing all of the level.lua files in a folder named GamePlay. Then I call the, through GamePlay.level1, would this be an issue? Or shall I change the naming convention? I have GameOver files as well, maybe that would be it.

Second, I understand now what you mean. The impulse is only active when the player is resting on a platform, so it isn’t as if there are opposing forces. But I will switch to velocity, and see what happens. Has this been an issue before?

Merry Christmas!!

Ryley [import]uid: 28237 topic_id: 34205 reply_id: 136051[/import]

Hi Ryley,
I noticed that “GamePlay.level2” notation, which is correct, so I’m not sure why it’s not working. Are you sure there’s not some other error? If possible, take your modules out of the subfolder and see if it helps on compile to device (unless this would make your folder/file structure a complete mess).

For #2, I generally suggest applying a linear velocity. Impulse is useful for some things, but for a character jumping off a platform, I think velocity is better. Try it and see if the result is what you need.

And Merry Christmas to you as well, take care!
Brent
[import]uid: 200026 topic_id: 34205 reply_id: 136058[/import]

Hello again,

I did change the naming convention, no fix. I have a hunch it is something with levelHelper, so I am looking into it. I will let you know

E: The LevelHelper did not fix it, so still not sure what the issue is. I think I will try a brief loading screen, just as a filler and see if that works!

This applyLinearVelocity is not working for me. I cannot find any documents about it, and although it seems like it should work, its not. I tried to do lua reflection to see if it would register, and I couldn’t access it. Could you provide me with the information about it? Like is it the same params as impulse?

I appreciate it, thank you! [import]uid: 28237 topic_id: 34205 reply_id: 136172[/import]

Hello Ryley,
For case #1, typically this occurs if you have a case-sensitive mismatch in the module(s) or file(s) you’re trying to load. The Simulator isn’t picky about this, but the OS demands that it be the same. Check your file calls again and ensure that you’ve case-matched everything exactly in all instances. There might be something else going on, but check that first.

Case #2, where are you getting this impulse value? Is the body sometimes moving downward (falling) when you apply the impulse? Remember that applying an impulse in any direction will be negated by any velocity in the opposite direction… so if your character is falling and you apply an impulse, it probably won’t do much. If you need a more constant jump height, I suggest you experiment with applyLinearVelocity() instead, which sets a dedicated velocity while cancelling out any offsetting velocities.

Brent [import]uid: 200026 topic_id: 34205 reply_id: 136033[/import]

Hey,

For the first one, I am storing all of the level.lua files in a folder named GamePlay. Then I call the, through GamePlay.level1, would this be an issue? Or shall I change the naming convention? I have GameOver files as well, maybe that would be it.

Second, I understand now what you mean. The impulse is only active when the player is resting on a platform, so it isn’t as if there are opposing forces. But I will switch to velocity, and see what happens. Has this been an issue before?

Merry Christmas!!

Ryley [import]uid: 28237 topic_id: 34205 reply_id: 136051[/import]

Hi Ryley,
I noticed that “GamePlay.level2” notation, which is correct, so I’m not sure why it’s not working. Are you sure there’s not some other error? If possible, take your modules out of the subfolder and see if it helps on compile to device (unless this would make your folder/file structure a complete mess).

For #2, I generally suggest applying a linear velocity. Impulse is useful for some things, but for a character jumping off a platform, I think velocity is better. Try it and see if the result is what you need.

And Merry Christmas to you as well, take care!
Brent
[import]uid: 200026 topic_id: 34205 reply_id: 136058[/import]

Hello again,

I did change the naming convention, no fix. I have a hunch it is something with levelHelper, so I am looking into it. I will let you know

E: The LevelHelper did not fix it, so still not sure what the issue is. I think I will try a brief loading screen, just as a filler and see if that works!

This applyLinearVelocity is not working for me. I cannot find any documents about it, and although it seems like it should work, its not. I tried to do lua reflection to see if it would register, and I couldn’t access it. Could you provide me with the information about it? Like is it the same params as impulse?

I appreciate it, thank you! [import]uid: 28237 topic_id: 34205 reply_id: 136172[/import]