Platformer Multiple Collisions and Sound issue HELP !!! :)

Hi everyone,
I just found about GDevelop and tried to make a platform game with the basic given sample.
So far so good but i would like to add extra collisions like player death ectc. For now the player can jump on an enemy and kill it but player does cannot get killed or loose energy since there is only one collision on the enemy. How can i resolve this?
And another problem is that the music kicks in late. So to prevent this is there a way to make game wait untill the sound is cached?

Preview of my basic game ;

eamusavirlik.com/cyber/ft/index.html

Hey cyberxtech,

I see that your character displays a hurt animation and sound when hitting an enemy so you might already have the collision set up. If you don’t make sure that you set something up like this:

In the tutorial you have the conditions being “collision” and “player is falling” , if you made another event with the conditions being “collision” and this time invert “player is falling”. That way it is only true when your character touches an enemy but IS NOT FALLING on them.

Having done that you can add actions to that event that would simulate a character death. The main types of actions would be stopping character motion, changing the animation to a death, playing a sound, and then leading into displaying a gameover screen. If you implement health, the action would then be subtracting from your variable health, and then you would create a new event with the condition being “health = 0” and that event would have the aforementioned death animation, stop motion, death sound, etc.

I hope that wasn’t too confusing. I’ve been using this program a lot the past few weeks working on my own game and while I can think up plenty of solutions this is the first time I’m putting one into words for someone else :stuck_out_tongue:

As for the music, I am currently having the same problem with my game once I export it and am trying to figure out a solution for it. If someone else knows that would be great! Otherwise I’ll post a solution if I find one.

Thanks !!! Player not falling solution sounds great. Think this will be the solution awsome really thanks…
I am a newbie to this whole thing i might ask few more questions sorry on advance. Regarding the sound issue i actually thought of o could pause the game before it starts and show some tutorial or anything and after start the game then the sound will be cached by then. Just dunno how lol… :smiley:

Just one more question. Since inverting the state for falling i think then player death or ectc would not be triggered by flying enemies since player is already in falling mode ?

By all means ask away! :smiley:

Alright a solution I worked out for the flying enemies. What you can do is edit the flying enemies object and add a point above the enemy. What I figured works best is to find out how tall your player character is on the y axis, then when you add the point on the flying enemy make the y coordinate the same number as the character is tall, make it a little less and then make it negative so the point is roughly 1 player height above the enemy, if that makes any sense at all :laughing:

Here’s a screenshot that hopefully helps explain it, I just used the default enemy from the tutorial and put him in the air to solve this.

Then when you go into the event editor you can make a condition that compares the y position of the player to the point of the flying enemy. To add this condition, it’s under “All Objects → Position → Compare Y Position of an Object”. Then you make sure that it is set to greater than if you want the character to be hurt/die, or set it to less than if you want the enemy to die. It’s reverse what you would think because up is actually a lesser Y-value than down.

Again if that is confusing here is a screenshot.

So effectively, this makes it to where the player HAS to be above the enemy to kill them. If they are beside or below the enemy when the collision occurs the player will get hurt/die instead. That should solve it for flying enemies. Keep in mind you may have to adjust the Y-position to suit the height of your player character, but just a little tweaking and it should work well.

Hope this helps!

Thanks a million got it working but i did get around it with the first suggestion you gave works like a charm thanks. I’ve updated the game. You can see how it works out there i will post a screenshot of the settings i’ve used under gdevelop to achieve it. The only remaining problems are… As usual sound lag and cannot play death animation effect due thr settings i’ve made but i think you’ll have to see the settings first. Meanwhile i need your opinion about the game. It means alot from a pro point of view. Thanks and regards.
Link to the game : www.eamusavirlik.com/cyber/ft/index.html :smiley: :smiley: :smiley:

You’ve made great progress since I played it the first time! I got to say I love the art style for it. The main menu and the gameover are beautiful on the eyes. The in game background is great and the parallax you have going just adds so much to the progression. You did well having the touch controls that disappear if using a keyboard, little touches that make a big difference, and the explanation for the objective is a nice touch to prevent any confusion.

Also I had to space this one apart just to emphasize it :stuck_out_tongue: I LOVE the title. The colored animation is great!

As for complaints, they’re not really complaints so much just as little fixes for the game mechanics. Such as the buttons right now they automatically trigger when the cursor is over them, there is a way to also make it to where the player has to click or on mobile they have to have the touch down. I can definitely help with that since that’s how all of the buttons in my game work. Also, I’m not quite sure if the player is supposed to die in 1 hit or if there are supposed to be multiple lives type of thing. Either way, is just the little addition of a death sequence or adjusting the collision and adding a delay so it doesn’t trigger multiple times in a row if the player has multiple lives. Both of those tweaks are very easy to do believe it or not, and I guarantee we can get a death sequence made up for you :smiley:

So long story short, just a few mechanic fixes and you have a beautiful game that just looks and sounds pleasant to play!

Hi and thanx for the outstanding comment & suggestions. Yups i wanna do a decent death animation ectc. but i am not sure if the way i did thing s will allow me that. Have a look please of how i got around things.

Also i want to improve this game and afterwards put it on Google play ectc. But i have my doubts regarding the sound issue.
There is still no work around for that as far as i see. I do not export with crosswalk i choose regular android in XDK. Crosswalk makes the file size bigger and arm edition of the apk needs a extra plugin which i dount any user would download.
So any suggestions? Thanks oh p.s. my email is funworxgames@gmail.com. thanks and regards.

Oh we can easily add a death sequence in there :smiley: I’ll post a screenshot of the simplified version of my death sequence from one of my games.

As you can see I had health in my game so it triggered when health reached zero, for yours it would simply go where the player collides with an enemy. Now the thing to pay the closest attention to is your timer. When your character dies it immediately changes the scene before the player knows what happened. You have a condition for your death timer to be at 0.2 seconds, now it’s important to realize that all timers start as the scene begins, so the best thing to do is to create a completely separate event with the condition “at the beginning of the scene” and set the action to “pause timer death”. Then when the character collision occurs create an action that “unpause timer death”, this will give you the time necessary to create and play a death animation for your character and for the player to understand what just happened, then the scene changes to your gameover and all is well. Occasionally the unpause timer is kinda off and your death will still trigger automatically, what you need to do in that case is set a subevent under the player and enemy collision with the condition “trigger once” and have it “reset timer death”. This will for sure give you the time you need before the game over screen kicks in.

That should solve your problem, and you can add some little details here and there. For example in my script you can see I change the time scale to give a slow mo effect when death occurs to let it sink into the player, it is a nice effect but just know that the time scale affects the timer rate, so even though my death timer is set to 0.4 seconds, since the time scale is half it actually takes 0.8 seconds. A few tweaks and tests here and there and you can get it right where you want it!

Hope this answers what you need! :smiley: Also it is exciting to put your game on Google Play, I actually just put my first game project on there just to see how the whole publishing process works, you can check it out here: https://play.google.com/store/apps/details?id=com.mcswine.stellarsprint

I too had the music problem and unfortunately it is also present on mobile devices. I figure since it was just a test game I will update it once someone finds a solution.

Dear McSwine,
I’ve tried that what you wrote earlier but did not work out for me so i just made a deatj animation in the game over screen whcih worked out not too bad. But now i face a another problem. Basicly i tell the game to do a change scene when the player score reaches a certian ammount. But to do so i need to say global variable = 1000 change scene well as you’ve guessed i have to input this in the external events global vairiables part or else it else it doesn’t work ok till here but you have to specify which scene to change to well i have a multiple level game so it just changes to the specified scene. That renders all the other scenes obsulete. Is there a way just to say “just go to the next scene in order” ? Thanks and regards.

In theory you shouldn’t need to use the external events. When you make an event using the global variable you can go to where you select a variable and you can set an initial value for it which I’m assuming would be 0. So the question is when the score hits 1000 does it switch scenes and keep the score so like level 2 at 1000, level 3 at 2000, etc… or does it reset to 0 and you have to get a score of 1000 on level 2 to go to level 3?

The difference that makes is if it doesn’t reset you can simply create an event in the scene for level 1 that changes the scene and you shouldn’t have to change the variable at all. From your description of the external events I’m guessing the score resets for every level, if that is the case create an event where the global variable score = 1000 and have the actions be change global variable score to 0 and change scene. Make sure you have the action change variable score BEFORE the change scene. Then you simply have level 1 change to 2, 2 to 3, etc. Because I currently don’t know of a way to simply number scenes and go to the next one. Here is an example screenshot.

That should do what you want to do and that way the score doesn’t interfere with other levels.

On a side note I am trying to tackle the music delay problem. I think it might have to do with the file type or size. What file extension are your audio files?

I almost about to give up on GDevelop geezzzz…
Can we just not create multiple collision masks and add different settings for each collision mask?
Example
Or i’ll just have to disable jump & kill option and replace it with some projectile to kill enemies so it’s easier to set something like that up i think. So porjectile collision kills enemies and enemy collision with player kills player. And its crucial to have a setting like when player gets hit and is going to die the engine should have disable all controls or paue scene play only bla bla bla animation ectc. Dunno i’m stuck here with loads of problems.
For example since i could not make the player play a death animation i have added a game over screen which the death sequence is played out there instead of in scene level1. I did the samething with level complete thingy but this time the audio got distorted. I did the same as game over screen “music is played on channel 0 - stop music on channel 0” so it would stop the previous scene’s soundtrack and after this event i’ve added ;
"music is played on channel 0 - play music on channel 0 file ost.ogg well not you don’t hear anything anymore. Ok last riddle player score vairable is equal or greater to score 2000 then do change scene to level2 right cool Works but hey ??? Only works if i put this code in external events - Objectmanagement so i can only skip from level 1 to to since i have o specify scene name and external events is set to all scenes im stuck with 2 levels. Geezz my head feels like it’s gonna crack this was supposed to be easy lol :slight_smile:
Please help me out i really have spend loads of time trying to get the game Fairy Tales together ectc. I really wanna do this and more so please help me out. Thanks in advance .
Regards,…

I’ve tried all ormats from 22.000Khz to 48.000Khz Wav and Ogg files i keep downsample them and convert them to mono so the byte count is small. Still no luck… It plays delayed at first startup afterwards it keeps it cached no problems there. As i said before i tried out Crosswalk export and normal Android export no difference heck the android export was half in size the crosswalks and needed no extra plugin to run the app so im keeping it on android.

Ugh this music is frustrating me :laughing:

So I just realized that you were going off of the platformer template, and that explains a whole lot. When I make my projects I script it all from scratch so I know how every script works. When you use a template it can be super confusing because it’s a different person’s thought process. I tried using the angry peas template for a launch game and I got so frustrated trying to understand it I finally trashed it started a blank project and made a little physics launch script myself in about an hour. It probably does the exact same thing but I understand it because I made it. If you have future troubles it might be worth starting a new blank project and copying over the scripts and objects you know for a fact you use. The less fluff the better and the more you can write yourself the more customized you can get it. Just a thought, but if you keep trying I’m sure you can figure out the template too. (Not going to lie I opened the platformer template and was so confused as to what was going on :laughing: )

I thought about your comment about the multiple hit boxes and there is a way you could do that. It involves making a separate object for the top, bottom, left, and right of your enemy but then that way you could customize each collision like how you want. Here is a quick sampe I threw together to demonstrate.

multiple collisions example visual.png

I hope that helps. I don’t want you to give up man, this challenge is all part of it and everything you are trying to do can be done (except the dang music :laughing: ). If worst comes to worst you could always share your project file in a private message and I could try to help you with some revisions or if you decide to start the blank project I could help you transfer over what you need, if you feel comfortable with that. I saw your rough draft of your game and I want to see it finished! :smiley:

Dear Mcswine;

As i told you before i am trully sorry for asking so many question but i’m totally new to this. I did as you told me and deleted the external events and have put them in the main level and it Works like charm now. Now i don’t have a level skip problem anymore your superb thanks for that. Just 2 things i need to clear up before i head and make other levels;
1.Can you teach me how to or where to find the expression like do= enemy … i could not find it or do it :frowning: in the editor so i’ve not setup any multiple collisions. Second of all i would like to display energy actually on screen gonna put hearts how do i do that or should it be lives instead of energy what do you think? If i put lives then player progress should be totally resetted after 3 death and the game shall return to level 1 no matter which level he or she is on. Energy thingy just makes it easier to play then again when player runs out of energy has to restart the level he or she is in? What do you suggest?.
Also my email is funworxsgames@gmail.com whats yours so i can send you over the gdg file ? And thanks a million really helped a lot.

Well it looks like you found my email :stuck_out_tongue:, I sent a very basic project that includes the energy/health system you were looking for. I personally believe that an energy system would be more fun for the player rather than a live system and I would also note that it would easier to script as well!

The main thing to indicate energy is simply changing to different animations of the object and have it correspond to a variable. If health= 3 show 3 hearts, if health =2 show 2 hearts etc.

In the project I sent I simply deactivated the player and displayed game over text when health hit 0, you could either show your game over screen or make it where it restarts the level like you were wanting.

I answer about the do= enemy in the post below, I didn’t know what you were talking about at first until I realized it was in my screenshot. Been a long day :smiley:

And like I said ask away! It’s important to be able to get help when you need it, and for me it’s a nice break to work on a different style project, like a platformer, rather than my launch type game so I honestly don’t mind! :smiley:

Right, I completely spaced you were referring to the collision boxes in my screenshot, sorry been a long day :smiley:

Right what I did was for the event action I went under objects to position and selected position of an object.

The object was the collision box, the modifier was = , then for x position if you click the sigma sign to the right of the box the E looking symbol, you can then select any object or variable. To get enemy .X(), In the left box I clicked all objects, then position, then x position, then you have to select an object which I selected enemy then you hit ok. To set the Y coordinate do the same process but instead of x position click y position.

I hope that helps!

Yo woke up at 5 am and got bored guess what :slight_smile: Check the link it’s alpha stage but hey just came up with it.
www.eamusavirlik.com/cyber/tr/index.html

Hope you like it…