Skip to main content
GameDev.net gamedev.net
🔒 Locked

Scrolling

Started by Dany May 18, 2003 at 11:55 AM 1 replies 850+ views
Original Post
Dany
Dany
I use this code but the scrolling effect dont look fine any ideas???I realy need to make it work , so help me please void MapEngine::Draw(int mapdraw_x,int mapdraw_y) { int i,j,mapx,mapy,map_xoff,map_yoff; mapx = mapdraw_x/64; //mapdraw_x,_y -from where to to start mapy = mapdraw_y/32; map_xoff = mapdraw_x & 63; map_yoff = mapdraw_y & 31; for(i=0;i<42;i++) for(j=0;j<20;j++) { int x,y; if((mapy+i)%2==0) x=j*64; else x=j*64+32; y=i*16; RenderTileID(Level[mapy+i][mapx+j].TileID,x-map_xoff,y-map_yoff); } }
Bagpuss
Bagpuss
What does your map do ?

and it would be slightly quicker to move the definition of x and y outside the loop, else you are making 2 declarations per loop, and wasting processor time.

And if you put the tags [_source_] and [/_source_] (without the underscores about your code, it will put it in a scrolling window.

Bp.
Dany
Dany
It is a diamond iso map.When I scroll it in the y direction it scroll good and in the next moment it''s like the screen resets and the first row disapear.I think it''s because the tiles are isometric and not squares or rectangles (i wouldn''t have this problem).Help!



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.