A box over the Mini-Map could be added to indicate which part of the layout is being viewed. Who says that you have the move the player? Maybe you could try moving other objects on the level.Ī viewing window could be used to view different parts of the level without moving any units around. If you didn't want the Player to move but you wanted to scroll when you clicked on the map you can replace the 'Set X/Y' action for the Player to a 'Scroll to' action for the System. This means wherever you click on the Mini-Map is where your Player will go, but also where you will view. The same happens if you position the Player over a hole or a pit.Ģ) The layout scrolls to the position of the Player. Since there is gravity if you reposition the Player in the air somewhere it will fall. Additional NotesĪlso, note that in this example the game type is a platformer. The same idea can be applied to the Y coordinate as well to move the Player anywhere you click on the Mini-Map. In our example, it would move the Player to 350 on the layout if you clicked on the Mini-Map where the red arrow is pointing. Going back to the whole event, the final actions will map the X position of the Player to this new number by setting it to mapclick_x. The layout width I have is 2500, so 14% of 2500 would be 350. So, since the value on the map was 0.14, or 14%, we also want to be at 14% on the layout. This translates the position clicked on the Mini-Map to the whole layout. Now we want to take that percentage value and multiply it by the width of the layout. (Mouse.AbsoluteX - Map.X)/Map.Width * LayoutWidth If the mouse was at the left edge of the map it would be 0% and if it was at the right edge it would be 100%. This means that the mouse is at 14% of the Mini-Map. Using the example in the picture, the red line would be 25 and the width of the Mini-Map is 180, so 25/180 is about 0.14. This gives us the X value in a percentage format. Next, we take this value and divide it by the width of the Mini-Map. Remember, in the previous tutorial we set the image point at this corner. Map.X is measured based on the top-left corner of the Mini-Map. AbsoluteX is used instead of just X because X is relative to the whole layout, but AbsoluteX shows the X position relative to the part of the layout you're looking at.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |