I’ve recently started using gdevelop for a project and I’m currently stumped. I’m trying to make a top-down game and have used a number of examples to setup the environment (which is just a png file for background). I’ve no problem with player movement so far but I’m having a bit of trouble with making boundaries that will prohibit the player from leaving the map. I’ve tried a number of solutions but nothing seems to work; I’ve tried the ff.: move player away from, separate objects–I’ve yet to try setting a limit to the x/y value as well as stop the object since I’m not so sure how to do so(despite there being an example for the latter since I believe there has to be an expression or variable value)–running the collision condition, setting up invisible barriers and solid objects, and even changing the z order of both the player and obstacle which is my wall.
There are two end results to what I’m trying to implement: a. the player is able to “walk over” the wall, and b. the player seemingly goes behind the wall but still walks out of the map. I just can’t seem to stop my player from going outside the map.
I think I may have to adjust my wall’s collision mask but I’m not so sure. Does someone have a solution to this? I badly need some help…
I’m a newbie too and had the problem too, but i’ve found a solution.
See my picture where the red sprites are the limitations.
And the event is “in collision with” “separate from” this limitations.
Ah, I see, let me try this for a bit and see how it goes, thank you kindly!
But um, is the green sprite in the house’s entryway a sort of trigger to an indoor scene? I’m also trying to go for something like that in my game you see
The green sprite is a action for entry the house yes, but i don’t have a event for this right now.
I’m at the beginning of gdevelop.
All the player can’t walk through/in/under… - whatever - need’s limitations!
If my answer was helpfull to you please click like it.
This also applies for @G4m3L0v3r (Sorry in advance if it is confusing or misspelled, I don’t have time to spellcheck right now)
If you want to set up a trigger to go to a house interior, you could put the inside of the house far away from the rest of the map, and then use the collision condition to see if the player has hit the trigger, and then center the camera on an object called “HouseInsideCenter” for example, which you place in the center of the house inside. Then have another object as a trigger on the exit, and recenter the camera on the player (You may need to move the player first using the add force or position action so that it’s no longer in collision with the trigger that causes that camera to center on the house interior).
If you want to use scenes (also good for multiple houses), you could instead create a scene for each house, and then use the “Switch scene” action to switch to them. If you want to be able to easily choose which house to switch to without a ton of different objects, you could have the trigger object have a text object variable called “SwitchesTo” for example, and in this variable you put the name of the scene you want to switch to when the player collides with the trigger ,and then switch the scene to the name of the variable. You could do this inside of the switch scene command by using:
You can switch TriggerObject out for whatever you call the trigger, and SwitchesTo to whatever you name the variable. Then just add an exit object an use similar code, but instead of a variable just put the name of the main scene. You can solve the issue of the player colliding with the trigger when the scene changes back by putting a “Trigger once” action inside of the code that switches the scene to the inside of the house.
Doing this requires code to run on multiple scenes and for that you might want to use an external event, and copy paste all of you current code there if you are only using one scene right now (You have to do it 1 line at a time to keep the order right). Then use a link action found by clicking the plus sign in the top right in the events editor and select the name of the external event. This will cause the scene to use all of the code within the external event. You will also need to make all of your objects global by clicking on the 3 dots and selecting “Set as global object” so that you can use them on multiple scenes.
Hey y’all, so I’m trying to implement a stats box similar to that of undertale. Here’s how it looks like:
I’m currently looking at an example using an inventory extension, and so far, all I actually get from the example is how to hide and show the stats box which is in a different layer called “in-game stats.”
What I want to know is how I can implement the following:
-a stats box that displays in-game when pressing S, covering the player preferably and taking up the area where the player is located [img below for area reference]
-a stats box that displays “G10 Student” and the long text found below the BP: 0 % & EXC: 0 pts. text (which I think is supposed to be linked to the separate stats box that I have in order to work, I’m not so sure…)
-increase and display the value of the BP & EXC text upon colliding with certain interactables (similar to how Score works on platformer examples in gdevelop)
>on another note, I’d also like to know how I can use the value of EXC in another scene and have its name changed to “hints:”
I’m not so sure if it’s even possible to implement but I’ll take any helpful input, and preferably soon if possible cuz I rlly need it…thanks in advance, peeps!
To be clear, there’s no such thing as “a stats box” in game logic.
In most cases, the developer is just displaying an object (the background), with some text objects on top of it, and the text objects are being updated to display variables being set elsewhere in the game logic.
You could do this relatively easily with a text object for each section (BP, EXC, the student label, and the segments before).
For the objects that are static, you don’t need to do anything, for the objects that are dynamic, you can just use the “Modify the text” actions to update those text objects to something like "BP: " + ToString(GlobalVariable(YourBP variable here)) + “%”
Then just use events to show/hide the objects as needed.
And I’ve once again been stumped by another problem, this time, concerning Yarn.
My code below was working ok until I added more nodes in the yarn editor…
When I preview the game, the beginning line of the IntroNote branch is the only thing being displayed even after i press return/enter (that is, when the player is in collision w/ “objectivebriefing”; the next lines are displayed only when the player is not in collision and the return key is being pressed). Is there some way of fixing this? An input would be great!
So, I’m once again stumped with how to work with the dialogue tree extension. I’m wondering how I can change a character’s dialogue after a certain branch has been visited; I want to make it so that when the player triggers a dialogue by colliding with the character, a different dialogue is displayed.
I’ve tried creating a variable that sets its variable to 1 when the first dialogue is triggered, and created a condition in a sub-event that would start the dialogue branch “Toriel1repeat” if the variable’s value was 1.
The result ends up with the dialogue in Toriel1repeat being displayed instead of the dialogue in Toriel1 even if Toriel1’s dialogue is yet to be displayed and/or triggered by the player.
How can I work around this? Should I maybe use the “branch has been visited” condition? Are there conditions that I have to invert in order for it to work properly?? Some help would be appreciated, thanks!