I’m trying out G-Develop 5 from the recent Humble Bundle, and so far it’s pretty bad (very clunky and laborious, virtually no documentation that means anything).
The main thing I’m stuck on right now is functions.
In my game scene, I have an object that has a standard Behaviour attached to it, for linear movement.
In my function, I want to either adjust that Behaviour so the movement occurs in a different direction, or failing that, remove the Behaviour completely so I can move the object manually.
As far as I can tell, I’ve created an Extension (although nothing I do seems to change the name from UntitledExtension) and created a function with one parameter of any object type.
The problem is, when I try to add an action, I select the parameter from the list, but then there are no options to touch the Behaviour. There’s a “De/Activate Behaviour” option, and if I choose that, it tells me that there are no Behaviours attached to the object and that I should attach one first.
What am I supposed to do here? Can I adjust the Behaviour’s settings in a function? Can I remove the Behaviour? How is a function supposed to work if the code doesn’t accept that the parameters might have Behaviours attached to them elsewhere?
The UI is pretty atrocious, so there are no clues anywhere I can find.
Anyone know this well enough to help an old newbie out, please?
So, I’ve got a game mostly completely working; all that remains is the victory animation sequence. To do that, I need to move the player object to a specific position on-screen.
The player has the Linear Movement behaviour attached to it, in exactly the manner you describe. I’ve set the X and Y speeds, and the game plays just fine.
So now there are a couple of different ways to achieve victory, and I figure rather than duplicating the events and the actions for each case, a function is the obvious way to go.
I’ve created the extension and the function - and thanks for showing me where I can rename it, btw, I can’t find that tip anywhere else!! - but I can’t find anything I can put in the function (which is of Action type) that would handle the only parameter, which will be the player object, that already has a behaviour attached.
Scene has an object that has the linear movement behaviour added to it.
I want to call a function that changes the linear movement behaviour’s values.
So if, for example, the object in the scene is linearly moving at 10 on the X, and 2 on the Y, I want the function to set that to 1 on the X, and 10 on the Y.
I know that I have to pass the object as a parameter to the function. What does the function need to do, in order to make that change?
Ok so you opened the LinearMovement extension and are editing the Behavior Functions on the right side of the moniter?
Could you make an external event for it?
When I add the behaviour to the object in the scene like you show above, then I right click the object and click edit behaviours; that gives me a form where I can enter the speed for x and y movement.
When I play the game, the object moves at the speed and direction I’ve entered.
That all works fine.
Now; I need to create a function.
To do that, I have to create an extension.
Having done that, I now need to write the code in the function - the actions I need it to do, in order to change the speed of the scene object’s behaviour.
I pass the object in as a parameter to the function, and then I’m stuck.
I wasn’t sure what you’re going for so I just had it multiply the original number you set in the object behavior by 20 in the function. In the event sheet I did a non trigger once on right key pressed and it flew off the page. So yeh why I don’t make games with movement hehe.
Oh when I was adding the action in the function, it showed the object and when I clicked it gave me a list, so you can choose which things you want to alter there
The linear movement behavior purpose is only to easily set a constant speed without adding an event at the beginning of the scene.
The “force” actions can be used directly to move an object with a speed that changes over time. There is also other movement behaviors that cover some common cases.
How do you want the object to move?