Qbasicnews.com
May 11, 2021, 10:55:37 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3
  Print  
Author Topic: Panning...  (Read 10278 times)
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #15 on: June 22, 2005, 02:51:54 PM »

Look at gfxlib.txt for the official documentation (information about and an example of IMAGECREATE is in there).
Logged
thesanman112
New Member

Posts: 15


« Reply #16 on: June 25, 2005, 09:55:36 PM »

well i think i understand what the problem is....your wanting to draw a scroller but have player able to move to edge of screen.. like the original zelda.. if this is correct then it should be easy...
maybe the best way would be to use the opengl commands....

but forget that for a second... you want to scroll the screen, therefore you need screen to write...imagine the whole world you want to make...now imagine the field of view of player, or screen coverage on that world...say 5 tiles left,5 tiles right,5 tiles down,amd 5 tiles up...now every move that you make keeps track of the tiles....+5 and -5 so when player goes beyond the border or field of movement, then you calcualte 5- and 5+ around player..roll them onto the screen opposite of movement...I have done a 360 degree scroller, but the player stands in the middle all the time and the screen moves around you...and i use 640x480 bitmaps.. always drawing 9 at a time some partially on screen[/code]
Logged
Foolish__1
New Member

Posts: 21


« Reply #17 on: June 27, 2005, 02:17:20 PM »

Well, not quite.  I want a scroller where the character stays in the middle of the screen at all times.  Think Final Fantasy 4 (American 2).  That's what I want to do.  That's it, that's all.  See to be quite the challenge though....  Sigh.  I've looked into this IMAGECREATE command, and it appears to be what I need.  However, I can't get it to work.  I'm running FB 1.3 and I use the example in GFXLIB...  but it won't complie...  Why?!

Thanks again!
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
TheBlueKeyboard
Wandering Guru
***
Posts: 334



« Reply #18 on: June 28, 2005, 07:17:25 PM »

You dont need to load mapdata ingame.
Just load it at the start into a big buffer, say, map(299, 299).
Then you wont have to read anything as its all in the buffer.

If I understand you correctly, what you want to do is make a huge bitmap with the map pre-rendered and simply pan it as you move the player?

Sorry if I misunderstand, Im still a bit confused Smiley
Logged

It's the difference between asking someone how much flour goes into pancakes, and handing them a sorry mix of oozing green goo and asking them to fix it." - Deleter

-Founder & President of the No More Religion Threads movement-
Foolish__1
New Member

Posts: 21


« Reply #19 on: June 28, 2005, 09:10:18 PM »

YES!!  That's what I want to do!  YES!!  But, think bigger...  Tiles are 27*27 pixels, and the largest area would be something like 2500 * 2500 tiles....
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
TheBlueKeyboard
Wandering Guru
***
Posts: 334



« Reply #20 on: June 29, 2005, 07:14:08 AM »

But why dont you make a true pixel scrolling engine with the map already stored in a big buffer? Would be much faster...and easier.
Logged

It's the difference between asking someone how much flour goes into pancakes, and handing them a sorry mix of oozing green goo and asking them to fix it." - Deleter

-Founder & President of the No More Religion Threads movement-
Foolish__1
New Member

Posts: 21


« Reply #21 on: June 29, 2005, 06:26:28 PM »

Juh?  Let me see if I get you right...  Say I wanted to make an area that was 2500 X 2500 tiles, each tile being 27*27 pixels, I would make an arrya that was (2500  * 27 = 67500) 67500 X 67500, and just used that?  Then keep track of the location of the player in a 2500 X 2500 array?  Interesting idea.  Is that what you meant?
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
TheBlueKeyboard
Wandering Guru
***
Posts: 334



« Reply #22 on: June 29, 2005, 06:43:52 PM »

Umm...I dunno if you have lots of time on your hands, but 2500*2500 = 6 250 000. Thats over six million tiles you'll have to map Smiley.

But no, you only store the tile index number, not the actual tiledata.
Code:

Dim Map(2499, 2499) As Integer


And to keep track of the player:

Code:

TilePlayerIsOn = Map(int(PlayerX / 27), int(PlayerY / 27))
Logged

It's the difference between asking someone how much flour goes into pancakes, and handing them a sorry mix of oozing green goo and asking them to fix it." - Deleter

-Founder & President of the No More Religion Threads movement-
Foolish__1
New Member

Posts: 21


« Reply #23 on: June 29, 2005, 08:51:55 PM »

Well, the screen is 23 by 17 tiles, so that's about 100 screens by 100 screens.  It's big, but keep in mind that it has to store the world map in that buffer, so I think it's reasonable.  Now, if I don't store the actual tiles in a buffer, they are just too slow to draw, so I'm back at square one.  That said, can anyone get IMAGECREATE to work?
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
TheDarkJay
I hold this place together
*****
Posts: 913



WWW
« Reply #24 on: July 01, 2005, 02:06:03 PM »

PLEASE NOTE: If this isn't what you want, sorry, just ignore this post.

So you want to load it tile by tile and the player stays in the middle? just use numbers to represent the tiles in the map array and out them in a CASE like

Code:
SELECT CASE tiletoput

CASE 1

PUT (x * 27, y * 17), tile1

CASE 2

PUT (x * 17, y * 17), tile2

'and so on.

END SELECT


You would need to have the screen x size a multiple of 27 and the screen y size a multiple of 17 (you could rely on FB clipping the tile though)

When i get to my pc at home i'll whip up an example.

Wouldn't this look terribly jumpy though?

Umm, and pixel by pixel isn't slow to draw?
FB is more than fast enough to handle this.
Logged

url=http://www.sloganizer.net/en/][/url]
Foolish__1
New Member

Posts: 21


« Reply #25 on: July 02, 2005, 08:46:46 PM »

FB is faster than QB, but it's too slow for what I'm doing.  There are four gfx layers involved, per tile.  And in order to achieve smooth paning, it would all have to be pre-loaded.  I've tried what you've said, and it ain't gonna fly.  Thanks though.

So, still, no one know how to use IMAGECREATE?

Thanks.
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
TheBlueKeyboard
Wandering Guru
***
Posts: 334



« Reply #26 on: July 02, 2005, 09:21:09 PM »

Ok, it seems like that you cant go beyond 8191*8191.
Code:

'Set screen mode
screen 18, 32,, 1

'Make the pointer that points to the buffer in memory.
Dim Buffer As Any Ptr

'Create the buffer and fill it with bright red color.
'8191*8191 was the biggest I could get to on my computer without crashing...
Buffer = ImageCreate(8191, 8191, rgb(255, 0, 0))

'Place down the buffer at (0, 0)
put (0, 0), Buffer, Pset

sleep

'Destroy buffer
ImageDestroy Buffer


So it seems like you're stuck with two options:

1. Split the screens into smaller 8191*8191 buffers.

2. Make a true pixel by pixel scrolling engine.
I'm 100% sure this can be done fast enough, I could even make a pixel*pixel scrolling engine with 4 layers for you. Smiley
Logged

It's the difference between asking someone how much flour goes into pancakes, and handing them a sorry mix of oozing green goo and asking them to fix it." - Deleter

-Founder & President of the No More Religion Threads movement-
Foolish__1
New Member

Posts: 21


« Reply #27 on: July 03, 2005, 10:15:17 PM »

Perhaps I'm stupid, but I got this far.  I have FB 1.3 and this is what I get when I compile that code:

buff.bas(9) : error 71: Array not dimensioned, befr: '('

Buffer - ImageCreate(8191, 8191, rgb(255, 0, 0))

This is why I can't get IMAGECREATE to work.  No matter what, this is what I get...  unless I...

change: Buffer = ImageCreate(8191, 8191, rgb(255, 0, 0))
 to: Buffer = ImageCreate(8191)

But, this, of cource, renders that line useless...  So back to square one...

Sigh.  Any ideas why?

Thanks.

So, a pixel scroller, how does that work?
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
TheBlueKeyboard
Wandering Guru
***
Posts: 334



« Reply #28 on: July 03, 2005, 10:55:30 PM »

This is a shot in the dark, but I would try downloading 0.14 and see if that works...just to try.

A pixel scroller...well, first you would load the tiles, and just plot it down. I can make an example pixel*pixel scroller with multiple layers for you if you want.
Logged

It's the difference between asking someone how much flour goes into pancakes, and handing them a sorry mix of oozing green goo and asking them to fix it." - Deleter

-Founder & President of the No More Religion Threads movement-
Foolish__1
New Member

Posts: 21


« Reply #29 on: July 05, 2005, 02:08:14 PM »

I would love to see one that worked.  Here's what I'm working with.  There are different areas in the game.  dungeons, towns, world map, ect. that each have their own tileset.  So, for each place, there is a master tile file that hold all the tiles, and all the information reguarding the tiles.  If it's an animated tile, is it passable, not passable, ect, as well as the actual tile pixel layout.  Now, there are two basic types of tile in our game, underlay and overlay.  Underlay is the groupd, overlay is everything on the ground.    Now, say you wanted to have a burning candle stick.  You would first put down a floor tile, then an overlay tile of a candlestick, then a second overlay tile that was animated of a burning small flame over all of that.    Tiles are 27*27, screen is 640 X 480 with a bit loeft over on all four sides.  

Good luck and thanks!
Logged

ou're damed if you, well, let's just say your screwed not matter what you do.
Pages: 1 [2] 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!