Advertisement

Scrolling in isometric engines

Started by February 12, 2001 02:17 PM
0 comments, last by pasman 23 years, 11 months ago
Hi , I am working on an isometric engine with tile size of 64x32. For displaying I''m using the following procedure (simplified) where screenx,screeny are the fine map coordinates.

  var x,y,plotx,ploty:integer;
  begin
    x0:=screenx mod 64;
    y0:=screeny mod 32;
    for y:=-1 to 32 do
      begin
        for x:=-1 to 11 do
          begin
            PlotX:=X*64+(Y AND 1)*(32)-X0;
            PlotY:=Y*16-Y0;
            map[screenx div 64 + x , screeny div 32 + y].draw(plotx,ploty);
          end;
      end;
  end;

The problem is that I cannot scroll the map on the Y coordinate. The movement is done by simply incrementing or decrementing screenY. In this case the map "jumps" very weird when the first row to display if even. I guess it''s because of the displaying procedure but I can''t find a way to fix it. If someone could help me I would be very greatfull. Thanks. [Edited by - pasman on March 7, 2006 10:44:56 AM]
I''m not sure what the C++ operator is (I know QBasic and VB, but am just beginning to learn C++) but in BASIC it is Int(). Try wrapping your divisions in Int() or whatever its C++ equivalent is. I was having the same problem in my VB DX7 tile engine, and though the logic was a little different, changing Cint(roudning - what you''re doing) to Int(w/o rounding) fixed it.

Try that.

This topic is closed to new replies.

Advertisement