Discuss Scratch
- Discussion Forums
- » Suggestions
- » Workarounds for Frequently Suggested Blocks! (vers. 4) (NOT ACCEPTING CONTRIBUTIONS, LOOKING FOR TAKEOVERS)
- lion334
-
100+ posts
Workarounds for Frequently Suggested Blocks! (vers. 4) (NOT ACCEPTING CONTRIBUTIONS, LOOKING FOR TAKEOVERS)
Hi y'all! I've just stumbled into this section and I just shortly wanetd to share my approach on making a “point towards x, y” script, but in a scrolling background (2d, top-down), with:
Element NextDestination of GoToX, GoToY being the Target Position
X, Y being the position of the Camera in the World
Mainly shared this because I think it really fits in here and when I was the one needing this formula I wasn't able to find one (and then it took me 2 hours to do this here…).
Btw the Formula is used for the Planes in my game “Airline Simulator”
Element NextDestination of GoToX, GoToY being the Target Position
X, Y being the position of the Camera in the World
define Point Towards
point in direction (([atan v] of ((((item (NextDestination) of [GoTo_X v]) - (x position)) + (x)) / (((item (NextDestination) of [GoTo_Y v]) - (y position)) + (y)))::operators) + ((180) * <((item (NextDestination) of [GoTo_Y v]) + (y)) < (y position)>))
Mainly shared this because I think it really fits in here and when I was the one needing this formula I wasn't able to find one (and then it took me 2 hours to do this here…).
Btw the Formula is used for the Planes in my game “Airline Simulator”
Last edited by lion334 (June 5, 2022 16:05:05)
- randomguy3513
-
1000+ posts
Workarounds for Frequently Suggested Blocks! (vers. 4) (NOT ACCEPTING CONTRIBUTIONS, LOOKING FOR TAKEOVERS)
1.1 “Broadcast received” boolean blockIf you want for it to be briefly return true then this workaround exists:
This would allow a project to detect when a broadcast is sent. But, there is a lot of ambiguity on how this would work. Would it return true if the broadcast was fired since the project was created, since the green flag was clicked, or since something else was broadcasted?
when green flag clicked
set [cool messaged received? v] to [1]
broadcast [cool message v]
wait (0.05) secs
set [cool messaged received? v] to [0]
when green flag clicked
repeat until <(cool messaged received?) = [1]>
say [i want cool message]
end
say [yay I got cool message]
Last edited by randomguy3513 (June 10, 2022 19:37:23)
- dertermenter
-
1000+ posts
Workarounds for Frequently Suggested Blocks! (vers. 4) (NOT ACCEPTING CONTRIBUTIONS, LOOKING FOR TAKEOVERS)
The owner of this sticky has told me on an external site that they will not be able to maintain it anymore. From this, they want to give this sticky to @_nix
- Discussion Forums
- » Suggestions
-
» Workarounds for Frequently Suggested Blocks! (vers. 4) (NOT ACCEPTING CONTRIBUTIONS, LOOKING FOR TAKEOVERS)