Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualblack_darkness

Posted 22 December 2012 - 11:35 AM

I would like my character to be the center of the screen at all times. I am using allegro and C++. Right now I am rendering the full 30x30 map at all times. But my end goal is to have only 9x9 rendering at once. I don't know if I should do this by changing the displays variables. (tried this but it just changed the windows size.) Or change the which part of the map is displayed. ( I tried this but the character wasnt centered and the map did change but character moved left, and the map followed. So I stayed in the same spot indefinitely. )

 

 

I achieved this result with this code.

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, (row*16 + hero.wloc*16), col*16, 0);                 }             }  
 

 

 

And it looks like this (Before and after 7 movements. Notice how the character isnt centered and the map isnt being drawn around him.)

 

example.png

 

 

 

 

 

Here is something I am curious about. Should I draw the whole map or only the part I am currently on?

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, row*16, col*16, 0);                 }             }  

 

 

For reference here is a screenshot of my character. Notice how he is in the bottom right corner.

 

Okay. I deleted the previous attempt at centering and this is how my character is displayed. Every time he moves the screen stays stationary. (notice how he is at bottom right of screen instead of centered.)

 

Untitled.png

 

 

The following video is an example of how I want my character to behave.

 

 

A release of my game.

https://www.dropbox.com/s/pxnnfmvwgslkxcs/negfaron.rar

 

Source code

main.cpp - http://pastie.org/5565697

make_map.h - http://pastie.org/5565698

main.h - http://pastie.org/5565699

 

 

Display initialization

 

ALLEGRO_DISPLAY* display = NULL;

#5black_darkness

Posted 22 December 2012 - 11:21 AM

I would like my character to be the center of the screen at all times. I am using allegro and C++. Right now I am rendering the full 30x30 map at all times. But my end goal is to have only 9x9 rendering at once. I don't know if I should do this by changing the displays variables. (tried this but it just changed the windows size.) Or change the which part of the map is displayed. ( I tried this but the character wasnt centered and the map did change but character moved left, and the map followed. So I stayed in the same spot indefinitely. )

 

 

I achieved this result with this code.

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, (row*16 + hero.wloc*16), col*16, 0);                 }             }  
 

 

 

And it looks like this (Before and after 7 movements. Notice how the character isnt centered and the map isnt being drawn around him.)

 

example.png

 

For reference here is a screenshot of my character. Notice how he is in the bottom right corner.

 

 

 

Here is something I am curious about. Should I draw the whole map or only the part I am currently on?

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, row*16, col*16, 0);                 }             }  

 

 

 

 

Okay. I deleted the previous attempt at centering and this is how my character is displayed. Every time he moves the screen stays stationary. (notice how he is at bottom right of screen instead of centered.)

 

Untitled.png

 

 

The following video is an example of how I want my character to behave.

 

 

A release of my game.

https://www.dropbox.com/s/pxnnfmvwgslkxcs/negfaron.rar

 

Source code

main.cpp - http://pastie.org/5565697

make_map.h - http://pastie.org/5565698

main.h - http://pastie.org/5565699

 

 

Display initialization

ALLEGRO_DISPLAY* display = NULL;


#4black_darkness

Posted 22 December 2012 - 11:20 AM

I would like my character to be the center of the screen at all times. I am using allegro and C++. Right now I am rendering the full 30x30 map at all times. But my end goal is to have only 9x9 rendering at once. I don't know if I should do this by changing the displays variables. (tried this but it just changed the windows size.) Or change the which part of the map is displayed. ( I tried this but the character wasnt centered and the map did change but character moved left, and the map followed. So I stayed in the same spot indefinitely. )

 

Display initialization

 

ALLEGRO_DISPLAY* display = NULL;

 

I achieved this result with this code.

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, (row*16 + hero.wloc*16), col*16, 0);                 }             }  
 

 

 

And it looks like this (Before and after 7 movements. Notice how the character isnt centered and the map isnt being drawn around him.)

 

example.png

 

For reference here is a screenshot of my character. Notice how he is in the bottom right corner.

 

 

 

Here is something I am curious about. Should I draw the whole map or only the part I am currently on?

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, row*16, col*16, 0);                 }             }  

 

 

 

 

Okay. I deleted the previous attempt at centering and this is how my character is displayed. Every time he moves the screen stays stationary. (notice how he is at bottom right of screen instead of centered.)

 

Untitled.png

 

 

The following video is an example of how I want my character to behave.

 

 

A release of my game.

https://www.dropbox.com/s/pxnnfmvwgslkxcs/negfaron.rar

 

Source code

main.cpp - http://pastie.org/5565697

make_map.h - http://pastie.org/5565698

main.h - http://pastie.org/5565699


#3black_darkness

Posted 22 December 2012 - 11:17 AM

I would like my character to be the center of the screen at all times. I am using allegro and C++. Right now I am rendering the full 30x30 map at all times. But my end goal is to have only 9x9 rendering at once. I don't know if I should do this by changing the displays variables. (tried this but it just changed the windows size.) Or change the which part of the map is displayed. ( I tried this but the character wasnt centered and the map did change but character moved left, and the map followed. So I stayed in the same spot indefinitely. )

 

I achieved this result with this code.

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, (row*16 + hero.wloc*16), col*16, 0);                 }             }  
 

 

 

And it looks like this (Before and after 7 movements. Notice how the character isnt centered and the map isnt being drawn around him.)

 

example.png

 

For reference here is a screenshot of my character. Notice how he is in the bottom right corner.


Here is a rar link with the .exe and the required files.

 

Display initialization

 

 

ALLEGRO_DISPLAY* display = NULL;

 

 

 

Here is something I am curious about. Should I draw the whole map or only the part I am currently on?

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, row*16, col*16, 0);                 }             }  

 

 

 

 

Okay. I deleted the previous attempt at centering and this is how my character is displayed. Every time he moves the screen stays stationary. (notice how he is at bottom right of screen instead of centered.)

 

Untitled.png

 

 

The following video is an example of how I want my character to behave.

 

 

A release of my game.

https://www.dropbox.com/s/pxnnfmvwgslkxcs/negfaron.rar

 

Source code

main.cpp - http://pastie.org/5565697

make_map.h - http://pastie.org/5565698

main.h - http://pastie.org/5565699


#2black_darkness

Posted 22 December 2012 - 11:16 AM

I would like my character to be the center of the screen at all times. I am using allegro and C++. Right now I am rendering the full 30x30 map at all times. But my end goal is to have only 9x9 rendering at once. I don't know if I should do this by changing the displays variables. (tried this but it just changed the windows size.) Or change the which part of the map is displayed. ( I tried this but the character wasnt centered and the map did change but character moved left, and the map followed. So I stayed in the same spot indefinitely. )

 

I achieved this result with this code.

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, (row*16 + hero.wloc*16), col*16, 0);                 }             }  
 

 

 

And it looks like this (Before and after 7 movements. Notice how the character isnt centered and the map isnt being drawn around him.)

 

example.png

 

For reference here is a screenshot of my character. Notice how he is in the bottom right corner.


Here is a rar link with the .exe and the required files.

 

Display initialization

 

 

ALLEGRO_DISPLAY* display = NULL;

 

 

 

Here is something I am curious about. Should I draw the whole map or only the part I am currently on?

 

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, row*16, col*16, 0);                 }             }  

 

 

 

Untitled.png

 

 

The following video is an example of how I want my character to behave.

 

 

A release of my game.

https://www.dropbox.com/s/pxnnfmvwgslkxcs/negfaron.rar

 

Source code

main.cpp - http://pastie.org/5565697

make_map.h - http://pastie.org/5565698

main.h - http://pastie.org/5565699


#1black_darkness

Posted 22 December 2012 - 11:12 AM

I would like my character to be the center of the screen at all times. I am using allegro and C++. Right now I am rendering the full 30x30 map at all times. But my end goal is to have only 9x9 rendering at once. I don't know if I should do this by changing the displays variables. (tried this but it just changed the windows size.) Or change the which part of the map is displayed. ( I tried this but the character wasnt centered and the map did change but character moved left, and the map followed. So I stayed in the same spot indefinitely. )

 

I achieved this result with this code.

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, (row*16 + hero.wloc*16), col*16, 0);                 }             }  
 

 

And it looks like this (Before and after 7 movements. Notice how the character isnt centered and the map isnt being drawn around him.)

 

example.png

 

For reference here is a screenshot of my character. Notice how he is in the bottom right corner.


Here is a rar link with the .exe and the required files.

 

Display initialization

 

ALLEGRO_DISPLAY* display = NULL;

 

 

Here is something I am curious about. Should I draw the whole map or only the part I am currently on?

 

            for(int col=0;col<height;col++) {                 for(int row=0;row<width;row++) {                     al_draw_bitmap_region(tileset, mv[col][row].sx * 16, mv[col][row].sy * 16, 16, 16, row*16, col*16, 0);                 }             }  

 

 

Untitled.png

 

How I want my character to behave.

 

A release of my game.

https://www.dropbox.com/s/pxnnfmvwgslkxcs/negfaron.rar

 

Source code

main.cpp - http://pastie.org/5565697

make_map.h - http://pastie.org/5565698

main.h - http://pastie.org/5565699


PARTNERS