Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » math oh my god
- Koamodo975
-
1000+ posts
math oh my god
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1123750499/ link here
so i dunno if anyone remembers but yesterday i made a topic about this roguelike thing im making, now i need help again. the sword is supposed to be held ‘over the shoulder/hip’(if you don't know what I mean you could look at either griffpatch's hack and slash development video or at this) anyway the problem is im using a different system for the body parts so that won't work(also i'm now trying griff's system just using a series of positions for it to clip to). i have no idea how to calculate where the sword should be or how it should rotate, anyone know how to do this?
I also have to figure out how to reverse-engineer the x and y direction code so the aimer points in the right direction.
so i dunno if anyone remembers but yesterday i made a topic about this roguelike thing im making, now i need help again. the sword is supposed to be held ‘over the shoulder/hip’(if you don't know what I mean you could look at either griffpatch's hack and slash development video or at this) anyway the problem is im using a different system for the body parts so that won't work(also i'm now trying griff's system just using a series of positions for it to clip to). i have no idea how to calculate where the sword should be or how it should rotate, anyone know how to do this?
I also have to figure out how to reverse-engineer the x and y direction code so the aimer points in the right direction.
Last edited by Koamodo975 (Feb. 5, 2025 20:38:50)
- JoeyjJoe
-
100+ posts
math oh my god
I'm not entirely sure what you're looking help for, but maybe try setting the sword to be at the players x and y pos and add an offset to tune it to your specific wishes
- Koamodo975
-
1000+ posts
math oh my god
yeah I know, but I dunno how to calculate where the sword should be. I'm not entirely sure what you're looking help for, but maybe try setting the sword to be at the players x and y pos and add an offset to tune it to your specific wishes
- JoeyjJoe
-
100+ posts
math oh my god
maybe give the sword its own x y var and make it its own entity?yeah I know, but I dunno how to calculate where the sword should be. I'm not entirely sure what you're looking help for, but maybe try setting the sword to be at the players x and y pos and add an offset to tune it to your specific wishes
- Koamodo975
-
1000+ posts
math oh my god
Consider it as a last resort, but I'm tryna keep everything in one sprite since some enemies will have weapons.maybe give the sword its own x y var and make it its own entity?yeah I know, but I dunno how to calculate where the sword should be. I'm not entirely sure what you're looking help for, but maybe try setting the sword to be at the players x and y pos and add an offset to tune it to your specific wishes
- s714655
-
100+ posts
math oh my god
Not sure what your trying to do but just make the sword go to player, point towards mouse, and move distance steps. loop
- WofyWritesHugeRPBios
-
100+ posts
math oh my god
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1123750499/ link hereA way you can do this is by putting the player at a specific position (0,0, is a good one) and then put the sword sprite where you want it to be. Look at the swords X and Y, then calculate the distance the X is from the players X and the Y is from the players Y. Then, finally, make the sword go to the player and change X by your calculated X number and change Y by your calculated Y number in a forever loop. You can use a variable to change the position the sword is in by using “If” blocks as well.
so i dunno if anyone remembers but yesterday i made a topic about this roguelike thing im making, now i need help again. the sword is supposed to be held ‘over the shoulder/hip’(if you don't know what I mean you could look at either griffpatch's hack and slash development video or at this) anyway the problem is im using a different system for the body parts so that won't work(also i'm now trying griff's system just using a series of positions for it to clip to). i have no idea how to calculate where the sword should be or how it should rotate, anyone know how to do this?
I also have to figure out how to reverse-engineer the x and y direction code so the aimer points in the right direction.
Last edited by WofyWritesHugeRPBios (Feb. 6, 2025 19:38:48)
- JoeyjJoe
-
100+ posts
math oh my god
you could make the sword x and y a local variable and have it as a cloneConsider it as a last resort, but I'm tryna keep everything in one sprite since some enemies will have weapons.maybe give the sword its own x y var and make it its own entity?yeah I know, but I dunno how to calculate where the sword should be. I'm not entirely sure what you're looking help for, but maybe try setting the sword to be at the players x and y pos and add an offset to tune it to your specific wishes
- Koamodo975
-
1000+ posts
math oh my god
well it does have it's own x and y, it's just the hand x-y because they're together. The real problem is actually figuring out what value the variables should have, since I'm not good at math like this.you could make the sword x and y a local variable and have it as a cloneConsider it as a last resort, but I'm tryna keep everything in one sprite since some enemies will have weapons.maybe give the sword its own x y var and make it its own entity?yeah I know, but I dunno how to calculate where the sword should be. I'm not entirely sure what you're looking help for, but maybe try setting the sword to be at the players x and y pos and add an offset to tune it to your specific wishes
- Koamodo975
-
1000+ posts
math oh my god
le bumo
Last edited by Koamodo975 (Feb. 12, 2025 19:05:17)
- Discussion Forums
- » Help with Scripts
-
» math oh my god