Sign in to follow this  
Iderik

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

Recommended Posts

Iderik    142
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this