Possible DrawRectangle bug + screens issue (advance_game template)

Well, this is getting me mad this last hours, so, I hope it wouldn't be something stupid or something really problematic.

I am developing a small and simple "Geometry Dash / The Impossible Game" prototype, in order to test some features, learn, having fun, bla bla bla, u know... XD. Whatever, the thing is that the first time you get to the Gameplay Screen, there is an issue whit a collision and also with the DrawRectangle funtion + its "overloads".
I don't even know how to describe it, it's so... dumb.
The DrawRectangle is inside a "for" which works propierly, but the Rectangles are not drawed, and the collision issue happens detecting the collision btw the player and the platforms (When a platform is alone or is the last one in the row). But the fun fact is that if the player "dies", so the gameplay screen is "reloaded" or even if you go to the ending screen and then come back to gameplay screen, everything works fine. The Rectangles are drawed and the collisions work propierly.
I am going to check it tomorrow morning again, but wow, it is really amazing. I have no idea about if this has been happening since the beggining or not, because I was always dying at least 1 time before reach one of these platforms, and I was also using textures since the beggining.

I have uploaded the build and project (together) in GitHub, the map is actually filled with platform rows in order to test this issue, so, If you want to check it, the problem is supposed to be in lines 369 and 625 of the "screen_gameplay.c". If you execute the game, just jump (KEY_SPACE) over the platform row and wait, look that the cube falls before the platforms row finsh, now, die (or press Enter), and do the same, the cube will fall propierly. You must check it the first time you open the game and then before dying. If you die before testing it, close the game and open it again.

I have already tried to Initialize the gameplay screen 2 times before starting, and init, unload and init again, and many weird things :P. As I said, I am going to check it again tomorrow, but I would really apreciate someone to check it, just for in case.

Here is the link to the GH repo: https://github.com/MarcMDE/TapToJump

Thanks!!!

PD: The code is kinda dirty, wanted to finish it fast, it's gonna be updated post GGJ. I'm sry ^^

Comments

  • edited January 2016
    I was wrong, doing this

    // Setup and Init first screen
    currentScreen = GAMEPLAY;
    InitGameplayScreen();
    InitGameplayScreen();


    "Solves" the problem, let's see whats going in
  • Hi MarcMDE, I checked the lines you said but I didn't find any issue...

    Just need to initialize screen once:
    currentScreen = GAMEPLAY;
    InitGameplayScreen();
Sign In or Register to comment.