Hi guys, I'm currently working on a top-down turn based rogue like. The camera follows the player (or enemy) around - whichever actor's turn it is. When it is the player's turn, I would like to display text as a menu but also have the camera above the player. Is there a way to print text without it being effected by the camera offset? Or should I be negating the offset with my print x/y co-ordinates?
A snippet of my player's draw function (called by function _draw())
function player:draw() --centre camera if it is the player's turn if actor_index == 1 then camera(self.x * 8 - 64, self.y * 8 - 64) end -- draw the player spr(0,self.x * 8, self.y * 8) textanimcolour += 1 if textanimcolour > 15 then textanimcolour = 0 end if actor_index == 1 then --if we are in the move_or_action state, draw the menu as well. if self.state == "move_or_action" then --recentre camera camera() --draw the menu local yoffset = 80 --move_or_action_menu is an array of strings for i=1, #move_or_action_menu do local text_col = 5 if i == self.menu_selection then text_col = textanimcolour end print(move_or_action_menu[i], 10, yoffset, text_col) yoffset += 10 end end end |
Apologies, I'm new to pico-8 and the forums, I'm not sure how to make the code indent when i paste it above. Happy to post the cart so far if it helps
P#35384 2017-01-10 05:52 ( Edited 2017-01-10 11:09)
[Please log in to post a comment]