• Advertisement
Sign in to follow this  

Console-based 2D game (C++ Scrolling map)

This topic is 3652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm back with a new project, last time I made a rpg game in console. With loaded maps when entering teleports. This new project I'm making, is a big map wich is scrolling when the player is moving. I've got a frame on x=40 and y=16 big, the big itself is x=120 and y=60. So if I'm moving to the south, the map should be updated with ++y; If my player is on x=40, y=40. Then I should draw How I figured that out: 40/2=20, so now I got the cord pos at the left of the frame. Like this: ########## <- Upper frame (look on calculation below) # # #<- HERE for calculation above ########## Then I need upper cord in the frame, 16/2=8 So now I got the upper left cord in the frame (Where I should start drawing from the map map[8][20]; then draw it to lower right corner. So I plus it with 40 and 20, and I get lower right corner frame pos. Do you understand? :P -------- Well, here is my problem! I test to draw out if my player is on a pos, it works fine (I think) :P Then I test to ++x; and clearscreen and update the map again. But it wont move to the left at all! I have no idea what is wrong, so I'm asking for your help! Here is my source: http://pastebin.com/m5ba60088 Here is my map.txt: http://pastebin.com/m5f3d67d2 Please, help me! Thank you so much for your support, bless to everyone!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement