Hello, I have a problem, currently I want a Sprite to rotate in the direction of the mouse, (so far everything is correct) but it rotates in the opposite direction to the desired one. For the “Origin point” of the Sprite to follow the mouse to work correctly, but I cannot find the place or the line of code to specify from which point the Sprite follows the Mouse
Current Code:
Rotate “Sprite” to "MouseX();MouseY() at “1500” degrees/seconds
Hi, your sprite takes the center-point as reference for the rotation. By moving the center-point you can affect the way how the sprite rotates. One thing is important for getting proper results: the sprite resource when loaded into the engine has to be always aligned horizontally with the origin-point to the left and the part of the sprite that should rotate to a specific angle to the right. The degree of the horizontal line to the right is by default 0. Thus, if the sprite is aligned differently you get not the results you want by setting a specific angle.
Not sure what you mean by that. You can rotate the sprite to any angle you like. In your file you just need to set the sprite as described above. If you drag the sprite in the editor and don’t like the default angle, you can manually rotate it as you want or set the angle in the events. Changing the center-point allows you to determine how the sprite rotates.
I want the floating arm to be followed by a point, in this case we have 2 points.
Center: well placed for rotation
Origin: I want to place it on top of the hand (that’s easy)
But while the center point serves to rotate, the origin point follows the mouse.
Currently the Center point follows the mouse but it does not give the desired effect since it follows it from the right of the Center point (as you mention) and not from the Origin point, the question is the following.
Is it possible to specify a command that will follow the mouse, but have the “Origin” point follow the mouse? If possible I would like to see an example of a code for reference please.
I installed all the extensions, but I still can’t find a command that allows me to specify from which point I want to rotate the image or from which point to follow the mouse.
Your angular-arm sprite has actually two angles and you have to choose one of them for your default alignment.
The first one is yours and this won’t work well. The blue circle is the origin and the yellow cross the center. You need to set the sprite like no 2, if you want the forearm to point in direction of the mouse position (you don’t need to use ‘siempre’, an event without condition is fired always anyway).
I think this is not how it is supposed to work and I read somewhere that it is better not to mess around with the origin-point too much (but maybe that’s wrong). Instead you should just add another point, but for getting the right angle that’s not necessary, you really have to set the sprite as shown above and it will work as you want.
I screwed up good and good, I started playing with the 2.0 physics engine (Sooner or later I had to add some objects that required “gravity”) for my arm problem, I looked for some options with the joints that the 2.0 physics engine uses , but once I put this setup in-game and got in contact with my character, everything went to hell… Currently, my character goes through the ground (Segmented into blocks), so I set a point under his feet that (to check the presence of surface) now I need to find the command that will help me to check the surface…
As for the arm, I’m looking at your options and I’m still looking for one related to the physics engine 2.0… (I think I’m going to have to study that extension very well, it seems to me that it came here to NOT leave…) Any any idea how to make my character not go through the ground? And are Physics 2.0 joints “the best” option?
Ok now i see, my character have “dynamic physics and that kill all”, Now have Estátic physics and are good! The arm… how I can “set like no 2”?
Edit: What I want is to be able to put the angle as samples in your drawing, being a pixel art game. with the rotation it “pixelates” me in a blurry and unrecognizable way, that’s why I’m desperately looking for an option, tool or method for the points or some extension or command that allows me to adjust that annoying rotation.
I want the arm (First Angle by the yellow cross and Origin point) to be “attached” to the character in order to allow that “rotation”.
The wrist (Second Angle) I want to follow the mouse cursor.
I’ve already tried to edit the drawing and I’ve been looking for a solution for several hours, but as much as I search I can’t find a way to make a “body joint” in gdevelop. I know it may sound annoying and I apologize for it, but if anyone in the community has any knowledge or implements any ideas (or solutions) to this, either by extension, command or something I don’t know I’d like to know.
You have to activate Physics also for your platforms.
The best option for what? If it is just about animation using physics is probably overkill. You can check the ragdoll example to see how you can put a character with physics together. Ragdoll - a game example from the GDevelop game making app | GDevelop The effect you get is however not of a normal character moving along.
Animation with events is possible but certainly not the easiest option. It would be much simpler to have a bunch of sprite frames.
Thanks, that really help my! Now i can finish that problem !!!
Edit:
In the end the decision is to put it together as multiple Sprites, the physics engine although it gave the result that more or less I was looking for, it had 2 problems…
1- The collision with objects that have that physics incorporated, something strange remains, I wouldn’t even know how to explain it…
2- I deduce that if I add the physics engine to all the objects in the game, it will reduce its performance by constantly “thinking” about the physics of each block.
My last question before closing the thread, if I put a physics engine on the Objects, but NOT commands, what real effect does it have on performance?
As far as I know - but I could be wrong - it has an effect on the performance and if you don’t really need the physics there is no reason to activate it.