![]() Let’s stop and explain this function very quickly and at a high level.We are going to use the following function to figure out the angle that each enemy unit needs in order to point towards the player object: point_direction(x1, y1, x2, y2).Now that we have a movable player on the screen we can turn our attention to the enemy units and add some tracking logic to them. If you do not use the Relative option, the character will instantly be placed to the coordinate specified which is not what we want to accomplish in this tutorial but could make from some interesting gameplay, such as teleportation. You should be selecting the Relative option if you are using the Drag and Drop Set Instance Variable component, this moves the player every frame the exact amount of pixels you are adding or subtracting from the coordinate.Likewise when moving a character LEFT or RIGHT the X coordinate needs to be changed in a way so that negative numbers move a character LEFT and positive numbers move a character RIGHT. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |