Qbasicnews.com
Panning... - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+--- Thread: Panning... (/thread-7462.html)

Pages: 1 2 3 4


Panning... - Foolish__1 - 06-02-2005

Hey all,

I have a bit of what many of you would call a 'basic' question... Sigh. I'm tring to make an RPG (how unique, en?) and I want it to pan, none of the Zelda style walk to the edge of the screen and get pushed over. So, any-hoo, the game is obviously made up of tiles. Now, I've run some 'tests' (I.E. made a program that did exactly this) and the way it worked is if you pused, say 'up' It would load the tiles that were one row above the area you were in and slowly slid the whole thing down. Now this system works fine BUT when you push 'UP' there is a small delay (as it loads the tiles into memory and such). This is only a problem when holding up to keep walking up. It's a very jerky walk.

I've done this kinda of stuff in C and it was done using a massive virtual buffer that first loading the entire map/town/dungeon/whatever and, well, you guys know how that works. Any way, how do I do that in FB? What's the best way to do something like this in FB?

My second question, what do VIEW and WINDOW do and how do they work? I just don't get them at all? It there a good command reference somewhere?

Thanks all!

-Pauli


Panning... - SotSvart - 06-02-2005

Try this link for a alphabetical list of FBs keywords:
http://www.freebasic.net/wiki/wikka.php?wakka=AlphaKeywords


Panning... - Antoni Gual - 06-03-2005

I never saw RTFM written so politely! :rotfl:

Foolish I, you can do the same things you did in C. Yo can use ALLOCATE, pointer indexing,...
You can do it gfxlib way, creating a big PUT buffer with IMAGECREATE, drawing all your tiles into it and PUT it to screen at differnt coords as your character moves...


Panning... - Anonymous - 06-03-2005

Code:
camerax% = char[0].x - (302 \ 2) - 1
  IF camerax% < 0 THEN camerax% = 0
  IF camerax% > ((map[0].room[char[0].currentroom].x) * map[0].tileset.x) - 320 THEN camerax% = ((map[0].room[char[0].currentroom].x) * map[0].tileset.x) - 320

  cameray% = char[0].y - (190 \ 2) - 1
  IF cameray% < 0 THEN cameray% = 0
  IF cameray% > ((map[0].room[char[0].currentroom].y) * map[0].tileset.y) - 200 THEN cameray% = ((map[0].room[char[0].currentroom].y) * map[0].tileset.y) - 200

  xtile% = camerax% \ map[0].tileset.x
  ytile% = cameray% \ map[0].tileset.y

  xoffset% = camerax% Mod map[0].tileset.x
  yoffset% = cameray% Mod map[0].tileset.y



  

  FOR tiley% = 0 TO 208 Step map[0].tileset.y
  
    FOR tilex% = 0 TO 320 Step map[0].tileset.x
      tiletoputx% = tilex% \ map[0].tileset.x + xtile%
      tiletoputy% = (tiley% \ map[0].tileset.y + ytile%) * (map[0].room[char[0].currentroom].x)
      tileindex% = tiletoputy% + tiletoputx%
      
     put (tilex% - xoffset%, tiley% - yoffset%), @map[0].tileset.image[(map[0].room[char[0].currentroom].layout[layertoput%][tileindex%] and 255) * map[0].tileset.arraysize], trans
          
    Next

  Next


look at this for a long time, and experiment until it makes a little bit of sense. if it never does, sorry. ill explain this stuff in detail, someday. theres other tuts out there about it. look for em


Panning... - Foolish__1 - 06-10-2005

Hey,

Thanks!... But I still have some questions. First, what does 'RTFM' mean? Perhaps I'm a little slow, but? SEcond, Okay, basically I wast to create a buffer larger than the screen. Now, I've tried and tried to get this IMAGECREATE command to work, but I just can't. I've read quite a few tuts on it an dbeen through command references, but It just won't work for me. Does anyone have a sample of it doing just this? Thanks again!

-Pauli


Panning... - Anonymous - 06-10-2005

rtfm = read the f___ng manual xD


Panning... - Torahteen - 06-10-2005

:rotfl: Oh! LMAO, now I get it :wink: .


............ - Foolish__1 - 06-18-2005

Hey, it's me, again,

Okay, I've tried to get IMAGECREATE to work, but I can't. Every example that I can find on the internet start like this:

<?php

Which gives me an error. If I get rid of that command, none of the other commands work. Next, I can't do it the way that your example lays out because the tiles have four layers, and are 27*27 at 640*480... It's just too slow to draw a new row each time. I have to do it in a similar way to IMAGECREATE. Sigh. Does anyone have an example of this actually working, in FB? Or perhaps a tut on this topic, again for FB, unsing a large buffer like I'm asking... Because I can't find one... Please help!!!

Thanks.


Panning... - TheBlueKeyboard - 06-18-2005

Sorry, Im a bit confused
are you trying to make a tile*tile or pixel*pixel scrolling engine?


Panning... - Foolish__1 - 06-20-2005

Well, both. When your character moves left, he moves one full tile (27 pixels), but it pans one (or two) pixels ata time, to make a more smooth transition.