Help with Throwing knives/Stars. Getting projectile to spin mid air

E

Elkrom

Guest
first time posting here, title says it all really just trying to figure out how to get projectiles to spin mid air. Have figured out how to throw the knife object and collide with enemies and do damage and all that but can’t seem to find any info anywhere on rotating the object mid air. I’m sure I could rig it in the sprite editor, and I read about physics_apply_torqe and angular impulse in the manual but I am not using physics in my room/project. If anyone could point me in the right direction I would be grateful. Got to where I am with the knife jus cut n pasting code from Shaun spaldings platformer tutorial . Thanks again
 
P

ParodyKnaveBob

Guest
Howdy, Elkrom, and welcome to the GMC. $:^ J

Glad to see you want to embellish things from a tutorial. Good fun + learning there! In short, look up image_angle in the manual, take note of where your sprite origin is, and experiment to your heart's delight. I bet you can get it. ~nodnod~

Regards!
 
E

Elkrom

Guest
Howdy, Elkrom, and welcome to the GMC. $:^ J

Glad to see you want to embellish things from a tutorial. Good fun + learning there! In short, look up image_angle in the manual, take note of where your sprite origin is, and experiment to your heart's delight. I bet you can get it. ~nodnod~



Regards!
Still very new to all this, just in my first couple weeks of having the actual program (spent a couple weeks on the demo as well), but I will see what I can do with that information. Thank you for the quick response. Any other leads in the right direction would be greatly appreciated.
 
Last edited by a moderator:
P

ParodyKnaveBob

Guest
Instead of "Bump" a mere twelve hours later, maybe you could tell the results of what you said you'd try to do with that information. $;^ J
 
E

Elkrom

Guest
Instead of "Bump" a mere twelve hours later, maybe you could tell the results of what you said you'd try to do with that information. $;^ J
Maybe instead of wasting both of our time with that comment you could relax and not get soo upset about a “mere” bump comment. Was just looking for help, as I said I’m new to all this and that includes forum etiquette apparently. I tried for awhile to get results with the information given and the most I got was the object would just be rotated after it was thrown, I couldn’t get a steady rotation. So I just did what I thought was easiest and rotated the sprite in the sprite editor and just animated it so I didn’t get stuck on that problem and I could move on until I know a little more to solve it myself. Thanks for the first response, not sure what good the second one did for either of us.
 
E

Elkrom

Guest
Just increase image_angle by a small amount every step (on the knife object).
Thank you I appreciate the response. I tried doing that jus wasn’t sure how. Everything I tried would just result in the object being rotated at x amount of degrees when it was created I couldn’t figure out how to keep it rotating.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Maybe instead of wasting both of our time with that comment you could relax and not get soo upset about a “mere” bump comment.
It may be a "mere bump" but it's against the rules and the post was polite and informative, and DID ask you to supply further information which was relevant to the topic. I think it's YOU that needs to relax... ;)

Thanks for the first response, not sure what good the second one did for either of us.
Obviously it didn't do any good at all as instead of using the EDIT button or MULTI-QUOTE tool to answer the other person, you - again - bumped the topic. This may seem like a minor thing to you, but when you have a topic on the forum waiting for a reply and it gets knocked off the first page (thus greatly reducing the number of potential replies it gets) because of someone constantly bumping a topic when they shouldn't, it gets very frustrating. It's a minor forum rule, but an important one, so please abide by it and when someone helpfully points something like this out, don't get annoyed about it. It's better that another member does something like this in a friendly way than have a staff member point it out to you. :)

As to your issue, you need to use the step event to increment the image_angle variable to have the instance rotate constantly. Note though that this will also rotate the collision mask, which may not be what you want. In this case you can create a custom "angle" variable, increment it in the Step Event, and then use it in "draw_sprite_ext" in the Draw Event to make the instance look like it's rotating when it's not really.
 

Yal

🐧 *penguin noises*
GMC Elder
Put something like image_angle += 6 in the step event (for counter-clockwise spinning, use -6 for clockwise).
 
E

Elkrom

Guest
Thank you guys, I’m actually happy with the results I got from doing it with the sprite editor and animation I don’t know why I was against that it actually fits the style more than i thought it would for some reason. And @Nocturne i apologize I didn’t realize that was against the rules i probably should’ve read them prior to posting that. I am going to save as and go back and try that, thank you. Once again I apologize for acting like that
 

Toque

Member
Welcome to GM.
Have fun making your game. Every great game needs throwing stars!!!!

Sometimes I use an animation over trying to code the effect. Both work.
 
Top