Hello everyone, this is my first post, congratulations for the amazing software you’re doing an amazing job with this game engine, very very useful.
These days I was teaching the brother of my girlfriend (which is 11 years old) to create simple games with GD.
One of the features he requested was to shoot bullets (of course ), after creating a simple event:
When press some button ->
- Create bullet at position of Ship
- Apply some force to the bullet
See the code:
Surprisingly, that doesn’t worked as expected. After the bullet was created, the object doesn’t started moving, same as no object was “picked” after being created.
The bullet example “Tanks” shooting worked here, but it is HTML5 platform.
I tried to compile the the game, and the resulting LinuxExe also had the problem of bullets not moving.
To solve the problem I had to create a event to add the force to any bullet that is in the scene.
This way the bullets can’t have different forces.
I think the event described above was supposed to work, applying the force to the recently created object. Both on OS Specific (Linux Bin) and HTML5 another platform.
This post is to register the experience, and also serve as a resource if this is a bug.
Thank you !
I think the way you have set it up the bullet only gets the force applied once in the instant you release key.
If you want it to constantly fly into the x direction you would have to create a new event and ommit the condition.
For applying different speeds to each bullet you could create an object variable “speed” for the bullet and assign different values to it. in the move event you can then apply the value of the variable as force.
Have you set the force damping to 1 (meaning that the forces continues to be applied after the action) instead of 0 (force only applied while the action is executed) ?
Thank you @Wendigo and @victor . I wanted to apply a constant speed to the bullet, the @victor’s TIP worked !
The problem was in my concept of damping, which I though the damping would apply deceleration on the bullet. Thought that 0 means no damping and the bullet would never stop. But with damping as 1, the bullet stands with the applied constant speed.
It was just a misunderstanding on what Damping means. Maybe adding some explanation on the label would help people to know what to do with that field.
Again, thank you !
I found a help page that says “Enter a length of 150 for the force, and a damping of 0, as the force will be continuously applied.”
The link is http://www.wiki.compilgames.net/doku.php/gdevelop/tutorials/beginnertutorial2?s=damping.
Thats Right ?
Thank you !
Because in the wiki’s example, the force action is continuously executed. It’s not the case in your events, as the force action is only executed on the object when created. So, put 1 as damping and it will work “like the force is continuously applied”.