

Jupiter hell diagonal movement code#
When the right arrow isn't pressed, it turns off, thus reducing the lagg in complicated projects when key pressed repeat until > point in direction (90 v) move (3) steps end You can make more scripts like this to code for other movement. This script is event-based and only turns on when the right arrow is pressed. For example, no one would always be moving in every direction in the game, so it's pointless to make a forever loop go through every single possibility of movement. Scratch is event-based, so you should try to utilize only as much as you need to process what is currently happening. In most instances, letmethink's script would work fine, but when you start making more complex and elaborate projects, you should try to reduce on the amount of work the project has to process every tick. With the rest of the combinations added in the start of the script should look like this:Īnd with that you are done. This only checks for the single key presses if there aren't already two keys being pressed at once.It isn't stopping the others from happening. It is checking for whether both the keys are being pressed together but isn't doing anything other than move more. This will not work as the script is not ordered properly.

What you may first try for this is to do this:

These will sense whether two of the basic keys are being pressed at the same time. This can be beaten through another set of scripts. However, the problem that this brings up is that when you move diagonally you move a lot further than when you move in the basic four directions.By now you should have something that looks like this. This can now be repeated for all the different directions.

For example, to move left, all you would have to do would be to point in the direction that is equivellent to left (-90 in this case) and move a certain number of steps - three for this example. Now, once you have grasped this basic concept, you can have many different opportunities.When an object moves 1 step - whatever direction it is facing, it still moves the same distance which can be proved using this script.You would normally expect the scratch cat to point towards the mouse, but, as its rotation style does not allow it to rotate - even when its rotation isn't 90 it still gives the impression that it is. I am going to explain this a bit… What clicking this does is that it means that whatever direction the scratch cat is facing it still gives the same image.Click on the dot that is a rotation style.First, click on the ‘i’ next to the sprite you want to move - for the purpose of this tutorial I am going to use the scratch cat.
Jupiter hell diagonal movement how to#
This tutorial will also show the reader how to make it so that diagonal movements are not biased in any way Lets go! - How to make 8 directional movement with circular movement This tutorial is going to explain fully the steps required in the process of making a character that can move in 8 directions. I'm going to make a big kinda tutorial about this. However, this is tricky and ran me into a few problems, so I was wondering if there was any easier/more efficient way to solve this problem. I wanted the sprite to go any direction in the same speed, even diagonally, so I thought that instead of changing the speed when the buttons are pressed, I should do some softer, more flexible programming and only change the direction when the WASD keys are pressed, and make another block of code that sends the sprite at a certain speed. But then I ran into a tricky problem- since I programmed it so that pressing one key would change the x/y value by 3 or -3, the sprite goes substantially faster going diagonally (for example, pressing W and A at the same time) than going straight down, left, or right, because the X value still changes by -3 even when the sprite is also moving on the Y axis by 3, therefore sending it at a speed similar to somewhere around 4-5. I also want it programmed so that pressing two keys at once would send you in that diagonal direction, for example, pressing W and A would send you diagonally up-left. Today, I wanted to make a bullet-hell game, so I just started off by trying to create some simple WASD movement.
