Tell me what offsets are, and how to use them. Provide specific code examples. How can I use an offset to move an image horizontally, versus vertically? How do you set it up so it scrolls across and reappears on the other side?
Offset is what moves the map with the player. One example of this is from this plat former I am working on right now is:
al_draw_filled_rectangle(j * 50 + offset, i * 50, j * 50 + 50 + offset, i * 50 + 50, al_map_rgb(255, 0, 0));
Now for moving the object horizontal vs vertically, you just have to add it to either the x-axis or the y-axis. X-axis is moving the object horizontally and adding offset the the Y- axis moves it vertically. For the object to reappear back on the other side you need to add a reset coordinate, which mean once the object gets to a certain coordinate you would reset the offset by subtracting how far you want to go.
No comments:
Post a Comment