Qbasicnews.com
January 28, 2020, 07:02:11 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: Scolling Background  (Read 7596 times)
bonfire89
Member
*
Posts: 25


« on: January 11, 2004, 01:11:47 AM »

I would like to write one of those games where the character remains in the middle, and the background scrolls right to left.

Can anyone give me any hints, or point me to a tutorial on how to accomplish this?


Thank You.
Logged
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #1 on: January 11, 2004, 01:13:55 AM »

Hint: tile scrolling engine. Information on building them is everywhere, as well as example sourcecode. Smiley
Logged

I'd knock on wood, but my desk is particle board.
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #2 on: January 11, 2004, 01:22:34 AM »

I've been thinking of that lately.
Actually (weirdly), I think it's easier to make a side-scroller engine (like Keene, for instance), than it is to make a normal Zelda-style scroller. My own weird logic tells me that. :roll:
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
bonfire89
Member
*
Posts: 25


« Reply #3 on: January 11, 2004, 01:34:24 AM »

I wouldn't know.

Im in grade 11 programming at school. And we really havn't done much graphics at all, but we just recieved our game assignment which will be due pretty much at the end of the year.
Logged
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #4 on: January 11, 2004, 01:40:54 AM »

If you're new at QB, you shouldn't begin with something so advanced...
My suggestion is a nice space-fighter, or a Tetris game with twists. Or Arkanoid.
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
bonfire89
Member
*
Posts: 25


« Reply #5 on: January 11, 2004, 01:45:33 AM »

not that new, grade 10 was all qb too.

I've made graphics move around the screen.. Made a bouncing ball that got smaller and smaller using parabolas, and a bunch of other things.

I think I can pull it off as long as I can figure out how to get the scolling background
Logged
bonfire89
Member
*
Posts: 25


« Reply #6 on: January 11, 2004, 02:13:34 AM »

I was just thinking, to make tones and tones of columns of of psets and using a 2d arrary


dim thing(left to right position, y for pset)


then normally it it may show left to righ position of  0 to 800

but then when a user presses the right button it may advance it to 0+1  to 800 + 1


and then you could put it in a for loop




for i = 0 + times pressed right button to 800  + times pressed right button
  for z = 0 to screen heigh
    pset (thing(i), thing(z))
  next z
next i



then of course I'd have to deal with colour some how.



in anyevent, I would assume this is garbage since the screen would just flicker horribly

or am I wrong?


then along with that, there can be an array wich would hold anything that it could possibly collide with.


actually this would be the perfect way to do it I think, as long as there is a way to stop the flicker








woa, just been reading on, maybe I need some type of buffer?
Logged
Anonymous
Guest
« Reply #7 on: January 11, 2004, 09:58:08 AM »

first off, hi Smiley havent seen you around good ta have ya.

but yeah. zelda style isnt *that* hard, but its not real easy either. Your idea with PSET is alright, but you gotta realize QB PSET is sloooooooow... you gotta learn how to poke to &HA000 to do anything remotely fast enough. (i think anyways) Really, it's soooo much easier to use tiles when doing pxp. if your tiles are 16x16 you just PSETd 256 pixels in the time you couldve done one Wink (well almost the same time but still). Ill give you a basic idea of pxp.

by the way you need a 'camera' to do that effectively, so ill show you how to do that too.

you have an x and y coord

in order to keep ur char in the middle of the screen we...

1. assume camera is upperleftmost postion on screen (actually we need camx and camy to do this)

2. Make sure CamX is Xpos - 160 (half the distance so its in the middle) CamY - YPos = 100 keep in mind this is 13h good luck going any other mode Wink

so now, you have to figure out where you are in the lay of things.

Lets say our tiles are 16x16

Code:

CamXTile = CamX \ 16 (\ = integer division; much faster)
CamYTile = CamY \ 16
YOffset = CamY MOD 16
XOffset = CamX MOD 16


now to put these tiles, you have to use this info, and you have to put an extra tile since one will be cut 15 out of 16 times.

Code:
FOR YPut = 0 to 200 step 16
FOR XPut = 0 to 320 step 16

Use your routine to put here at XPut - XOff, YPut - YOff

NEXT
NEXT


Keep in mind the CamXTile, CamYTiles are really only there for ease of getting your info out of your map array. Oh, and you cant just use QB PUT for this one, cause it goes off the screen. better read up how to do that Wink... or get a lib Tongue. This maybe isn't anything how you wanted to do it, but hey i tried Wink Oh, by the way

to put ur char, you do something like this...

Code:
XPos - Camx, YPos - CamY


and when you update your camera (which should be every iteration, just in case Wink) you gotta throw in something like this.

Code:
if CamY < 0 then CamY = 0
if CamX < 0 then CamX = 0


plus checking for the right and lower side as well.. since i dun know ur map size, i cant tell you what to use Wink

sorry if this is confusing. Wink
Logged
bonfire89
Member
*
Posts: 25


« Reply #8 on: January 11, 2004, 01:42:32 PM »

hey thanks for the reply, I'm brand new here. But have to create a game for school, so I'll probably be around more from now on.


Thanks for the reply, I just woke and groggy, so I shall give it another read in a bit

Thanks
Logged
bonfire89
Member
*
Posts: 25


« Reply #9 on: January 11, 2004, 02:29:00 PM »

ooOOOooo

I have just advanced my knowledge to know tiles. I could do what I was prevously thinking, but using tiles.

That will require thousands of tiles though.

And I would have to load all of them into get things

I have sort have read that I can do that, with out it ever having to display that on the screen with somthing to do with screen7

also, I know what you mean if a tile is partly on the screen...  Ihave to learn how to deal with that.



can you havea dynamic variable name?

eg


for i = 1 to 10
put (1,1), tile i %, pset
next i


and then that would work out to be
put (1,1), tile1%, pset
put (1,1), tile2%, pset
put (1,1), tile3%, pset
put (1,1), tile4%, pset
put (1,1), tile5%, pset
put (1,1), tile6%, pset
put (1,1), tile7%, pset
put (1,1), tile8%, pset
put (1,1), tile9%, pset
put (1,1), tile10%, pset
Logged
Anonymous
Guest
« Reply #10 on: January 11, 2004, 03:23:41 PM »

not unles youre using qb7.1

im coming out with a top-secret way of doing this Cheesy:D:D but im not gonna release it till the game im working on comes out... sorry Cheesy
Logged
bonfire89
Member
*
Posts: 25


« Reply #11 on: January 11, 2004, 03:40:01 PM »

how soon till your game is released? lol

I think some how I would have to convert a string into a array name
Logged
Anonymous
Guest
« Reply #12 on: January 11, 2004, 03:43:21 PM »

not for a while ;p sorry..

no offense to you i dont know ur level of codage, but its a bit complex... if you want help making your game though i could prolly give you some pointers if i know specifics... but yeah others here could help you way more im sure Wink
Logged
bonfire89
Member
*
Posts: 25


« Reply #13 on: January 11, 2004, 03:50:25 PM »

I know what I am trying to accomplish is a little beyond me, but I would like to give it a shot, before I settle for a game with a non moving background which I have the knowledge for, for sure.


Right now the way I am thinking would work I'd think. But I would need to be able to variable names change dynamicly


it would be awsome if I could do somthing like

GET (10,10)-(30,30),imagearray(5)

but I tryed that and recieved an error




I could code it all with no loops, typing out each array name and that would work.. It wouldn't be too bad acctually, I know ASP and I could just code somthing that gives the output I want, and then copy paste it into QB
Logged
Anonymous
Guest
« Reply #14 on: January 11, 2004, 03:56:41 PM »

yeah dude... thats how i was doing it for a while... select case arraynumber Tongue

that sux!!! can you use 7.1? if so you can dim types with arrays in em
Logged
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!