14/03/25 Adding the background, attempting to add RNG to the fish and general improvements.
Hello! for the rest of this week I've been attempting to add a RNG aspect to the fish because that was one of the key selling points for my game's pitch however all my attempts ended in failure and that's something I will be blogging about today. Before I talk about that however, I'll bring up things I managed to successfully implement and refine.
First of all, I redesigned the danger zone aspect. Originally it was coded to make it so that if the sprite of the water asset collided with the player, the player would die, and the game would restart. Now however, I've made it so that if the player exceeded a specific y level it would do the same thing. This is what the code looks like now:
I've done this because previously the player would die on top of the water, and it looked very flat and unappealing. Now I've used layers to make it look like the seal is actually going into the water because it missed its jump. This is what the gameplay looks like now:
Also, you can probably see I've added a background to my game, this was achieved using layers. I have a layer that's behind all the base layer stuff (the plane where the player can interact with the game).
So, I have a layer for my background, one for the score display and one for the water so the player will be under that layer to create the effect that its going inside of it. Speaking of scores, I also refiled that aspect by putting in my code that the fish will be deleted when the player collides with the fish so then the player gains only one point when they jump on a fish. This was to make the game more challenging as previously the fish kept giving points because the player was still touching it.
I also managed to figure out how to add music into my game:
Now I'm going to talk about my attempts on adding RNG to my game so far. Firstly, I watched two different methods on how to do this, one used basic coding provided in the program and the other used variables. Firstly, I tried to use the tutorial that was found on the official Gdevelop channel where the code essentially says a fish will spawn at a "Fish_Spawn" sprite and will pick a random fish from the group provided but it didn't work.
Before I start talking about the second method I used; I'd like to give credit to the youtuber, Winstreak as I used their code as a reference for what I'm trying to do and their video explaining variables used in RNG was very helpful. I'll link it here:
How to Pick a Random Object from a Group of Objects in Gdevelop
Anyways what I was trying to do was essentially the same as what they demonstrated in their video however because I am trying to pull a random sprite from one group rather than a random loot drop my variables looked like this:
I then used what they did in their example and tweaked it to make sense in my context:
Despite my efforts and hours of tinkering, I never managed to get this to work :(. I'll keep trying to figure it out but, in the meantime, I just have the platforms preset for playtesting purposes:
Anyways that's all for today, I think I'll focus on adding an opening menu start screen next o7. Kieran signing off.
Comments
Comments disabled.