Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Moving around world

Author
Message
Jcamden
12
Years of Service
User Offline
Joined: 5th Oct 2011
Location: Washington
Posted: 23rd May 2012 22:07
Alright i'm stuck....

If im pasting a map using dbPasteImage how do i move around the world?

Thanks

Joe
DeadTomGC
13
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 24th May 2012 02:05
I don't believe there is a way to do this besides just move the location that you are pasting the image to.

BTW using dbSprite is much faster than pasting.


Jcamden
12
Years of Service
User Offline
Joined: 5th Oct 2011
Location: Washington
Posted: 24th May 2012 05:30
Yeah, I know it's faster however when I use dbsprite the map doesn't show up. I'll paste the code when I get home tonight.

Thanks,
Joe

Joe
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 24th May 2012 07:03
Hopefully this 2D Game Algorithms page will be helpful.

Regards,
JTK
Jcamden
12
Years of Service
User Offline
Joined: 5th Oct 2011
Location: Washington
Posted: 24th May 2012 09:19
Alright, here's the code for the map array


const int MapTiles[MaxWidth][MaxHeight] =
{
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,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,1,1,1 },
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 },
{ 3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3 }
};

and here's the code for the map to be displayed on the screen


void LoadMap(void)
{

dbLoadImage("grass.bmp", GrassLayer);
dbLoadImage("dirt.bmp", DirtLayer);
dbLoadImage("water.bmp", WaterLayer);
dbLoadImage("filler.bmp", FillerLayer);

for(int i = 0;i < MaxWidth; i++)
{
for(int j = 0;j < MaxHeight; j++)
{
// dbPasteImage(MapTiles[i][j],i*32,j*32);
// dbSprite(1,i*32,j*32,MapTiles[i][j]);
}
}
}


Paste image works however sprite does not.

help! lol..

Joe
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 24th May 2012 16:22
Use dbSprite(ImageID, X, Y, SpriteID)
Jcamden
12
Years of Service
User Offline
Joined: 5th Oct 2011
Location: Washington
Posted: 24th May 2012 18:19
lol, sry guys. I figured it out. Sometimes I miss the most simplistic things. I wasn't using a counter for the dbsprite cmd and that's why it wasn't displaying the images.

I'm working on something pretty neat actually and i'll post some game code later.

Thanks!
Joe

Joe
DeadTomGC
13
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 25th May 2012 04:59
Ok, sweet. Hey, you could use the fstream header to be able to load in that array from a text file.


Login to post a reply

Server time is: 2024-04-19 15:28:28
Your offset time is: 2024-04-19 15:28:28