Making my sprite jump

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Malifeks
Coder
Posts: 12
Joined: Mon Apr 28, 2008 9:03 pm

Making my sprite jump

Post by Malifeks »

I am trying to make a plaforming game in qbasic and have my background and sprite set up and movable i just cant figure out gravity or making the sprite jump. please excuse the horrid sprite i just threw it togethere real quick :X. what i have so far is

Code: Select all

REM game
CLS

DIM TOON(1000), TOONSH(1000)
DIM SPRITE1(50), SPRITE2(50), SPRITE3(50)               'DIM ARRAY
DIM MAP1(30, 15)
SCREEN 13

XSV = 1
TOONX = 15
TOONY = 8
 

FOR Y = 1 TO 13                               'LOAD BRICK
FOR X = 1 TO 15
READ CLR
PSET (X, Y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE1

FOR Y = 1 TO 13                               'LOAD SKY
FOR X = 1 TO 15
READ CLR
PSET (X, Y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE2

 
FOR Y = 1 TO 13                               'LOAD BUSH
FOR X = 1 TO 15
READ CLR
PSET (X, Y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE3

CLS
                                              'MAP
FOR Y = 1 TO 15
FOR X = 1 TO 30
READ MAP1(X, Y)
NEXT: NEXT


CLS

FOR Y = 1 TO 20                               'LOAD TOON
FOR X = 1 TO 20
READ CLR
PSET (X, Y), CLR
NEXT: NEXT
GET (1, 1)-(20, 20), TOON
 

FOR Y = 1 TO 20                               'LOAD TOON SHADOW
FOR X = 1 TO 20
READ CLR
PSET (X, Y), CLR
NEXT: NEXT
GET (1, 1)-(20, 20), TOONSH





FOR Y = 1 TO 15
FOR X = XSV TO XSV + 20
IF MAP1(X, Y) = 1 THEN PUT (X * 15 - XSV * 15, Y * 13 - 13), SPRITE1
IF MAP1(X, Y) = 2 THEN PUT (X * 15 - XSV * 15, Y * 13 - 13), SPRITE2
IF MAP1(X, Y) = 3 THEN PUT (X * 15 - XSV * 15, Y * 13 - 13), SPRITE3
NEXT: NEXT

PUT (TOONX * 20 - 20, TOONY * 20 - 20), TOONSH, AND
PUT (TOONX * 20 - 20, TOONY * 20 - 20), TOON, OR


DO
PRESS$ = INKEY$

IF PRESS$ = CHR$(0) + CHR$(75) AND MAP1(TOONX - 1, TOONY) <1> 1 THEN TOONX = TOONX - 1
END IF

IF PRESS$ = CHR$(0) + CHR$(77) AND MAP1(TOONX + 1, TOONY) <> 1 THEN
IF TOONX < 20 THEN TOONX = TOONX + 1
END IF

IF PRESS$ = CHR$(0) + CHR$(72) AND MAP1(TOONX, TOONY - 1) <1> 1 THEN TOONY = TOONY - 1
END IF

 

IF OLDTOONX <> TOONX OR OLDTOONY <> TOONY THEN
OLDTOONX = TOONX
OLDTOONY = TOONY


FOR Y = 1 TO 15
FOR X = 1 TO 21

IF MAP1(X, Y) = 1 THEN PUT (X * 15 - 15, Y * 13 - 13), SPRITE1, PSET
IF MAP1(X, Y) = 2 THEN PUT (X * 15 - 15, Y * 13 - 13), SPRITE2, PSET
IF MAP1(X, Y) = 3 THEN PUT (X * 15 - 15, Y * 13 - 13), SPRITE3, PSET
NEXT: NEXT

PUT (TOONX * 20 - 20, TOONY * 20 - 20), TOONSH, AND
PUT (TOONX * 20 - 20, TOONY * 20 - 20), TOON, OR

END IF
 
LOOP UNTIL PRESS$ = CHR$(27)


DATA 07,07,07,07,07,07,08,08,07,07,07,07,07,07,07        
DATA 07,06,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,06,06,06,06,08,08,08,08,08,08,08,08,08
DATA 07,06,06,06,06,06,08,08,08,08,08,08,08,08,08
DATA 07,08,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,08,08,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,08,08,08,08,08,06,06,06,06,06,06,06,06
DATA 07,06,06,08,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06

DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03        
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03



DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03         
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,02,02,03,03,03,03,03,03
DATA 03,03,03,03,03,03,02,02,02,02,03,03,03,03,03
DATA 03,03,03,03,03,02,02,02,02,02,02,03,03,03,03
DATA 03,03,03,03,02,02,02,02,02,02,02,03,03,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,03,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,03,02,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03
DATA 02,02,02,02,02,02,02,02,02,02,02,02,02,02,02




DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1



DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,01,01,01,01,01,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,01,00,00,00,00,00,01,00,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,00,01,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,01,00,00,00,00,01,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,01,01,01,01,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00


DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,001,001,001,001,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,255,001,255,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,001,001,001,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255

please excuse my noobiness any help on gravity and jumping would be greatly appreciated.
thanks
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

You can label your data fields

Post by burger2227 »

To READ certain DATA fields you can use RESTORE fieldname



Code: Select all

RESTORE Bush                                'goto the DATA label
FOR Y = 1 TO 13                               'LOAD BUSH 
FOR X = 1 TO 15 
READ CLR 
PSET (X, Y), CLR 
NEXT: NEXT 
GET (1, 1)-(15, 13), SPRITE3 

Bush:                                   'sprite label 
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03          
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03 
DATA 03,03,03,03,03,03,03,02,02,03,03,03,03,03,03 
DATA 03,03,03,03,03,03,02,02,02,02,03,03,03,03,03 
DATA 03,03,03,03,03,02,02,02,02,02,02,03,03,03,03 
DATA 03,03,03,03,02,02,02,02,02,02,02,03,03,03,03 
DATA 03,03,03,02,02,02,02,02,02,02,02,02,03,03,03 
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03 
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03 
DATA 03,03,02,02,02,02,02,02,02,02,02,02,02,03,03 
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03 
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03 
DATA 02,02,02,02,02,02,02,02,02,02,02,02,02,02,02 

Once you GET the sprite info into the array, you can PUT it anywhere ON THE SCREEN. PUT only needs the top left corner coordinate. You cannot PUT an image 1 pixel offscreen!

Ted
Last edited by burger2227 on Thu May 01, 2008 9:24 am, edited 1 time in total.
Malifeks
Coder
Posts: 12
Joined: Mon Apr 28, 2008 9:03 pm

Post by Malifeks »

Thanks for that help :D sorry im pretty noob at this stuff....... still though if someone can help with making my character jump it would be much appreciated.... thanks in advance
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

JUMP?

Post by burger2227 »

What do you mean by jump? You can move it anywhere with PUT. To erase the previous position use a black box.
Malifeks
Coder
Posts: 12
Joined: Mon Apr 28, 2008 9:03 pm

Post by Malifeks »

By jump i mean a game type jump like you press w and make the character go up then back down while being able to control it... if that makes any sense.
markm
Coder
Posts: 14
Joined: Thu May 01, 2008 11:08 am

Is this a physics question or a graphics question?

Post by markm »

That is, do you need some help with the math of when and where the sprite should move?
Malifeks
Coder
Posts: 12
Joined: Mon Apr 28, 2008 9:03 pm

Post by Malifeks »

yes like basicaly i need if i press a button then y increases to somewhere then when it gets there it comes back down...... i cant quite figure it out though
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

Post by TmEE »

Have a variable which has say 10 in it, and each frame subtract 1 form the sprites Y coordinate, and subtract 1 form 10... then when 10 is 0, start adding 1 to the variable that had 10 in it and add 1 to sprites Y coordinate... will give you some jumping ability... nothing smooth...
Mida sa loed ? Nagunii aru ei saa :P
markm
Coder
Posts: 14
Joined: Thu May 01, 2008 11:08 am

Post by markm »

It's been over ten years since I did any graphics in Basic, so I don't remember: Does Y on the screen increase downwards (that is, you have to subtract instead of add to get it to go up)? If you want to work with a more conventional set of coordinates, you can always transform them right before displaying things, e.g.:

Y_Screen = Y_Scale*(Y_Origin - Y)

If you want the program to run on other computers, it's critical to somehow make the timing machine-independent. I understand the TIMER function will do that, but it only has 18 ticks a second, so if you update at each tick I think the graphics will be somewhat jerky due to the slow "frame rate". The good thing about that is that an oversimplified physics model shouldn't be noticeable. For a "cartoon physics" jump upwards, you can program like this:

for I= 1 to 10
y=y+1
x=x+1 'If you want horizontal motion during the jump
WaitForNextTimeTick
MoveSpriteTo(x,y)
next

x=x+1 'If you want horizontal motion during the jump
WaitForNextTimeTick 'insert a little "hang time" at the top

for I= 1 to 10 'Bring it back down
y=y-1
x=x+1 'If you want horizontal motion during the jump
WaitForNextTimeTick
MoveSpriteTo(x,y)
next


That's cartoon physics because of the constant velocity going up and then down, where in the real world y-velocity is constantly changing, but you have to get really good graphics before people will notice the difference. For more realism, decrease the amount you increment y until it is zero at the top and then continue decreasing the increment into negative numbers until y returns to the original level. (In physics terms, your increment is your velocity, and the change in increment per step is the acceleration of gravity.) If it's a jump across something (with x motion), the x velocity stays constant, so you just keep incrementing x with a constant the whole time the sprite is in the air.

Or (if there's no x motion), you might just increase the interval between constant-distance moves on the way up and decrease it on the way down.

Whatever, expect to play around with the constants until it _looks_ right.
Lanlost
Newbie
Posts: 5
Joined: Tue May 06, 2008 4:38 am

Hey..

Post by Lanlost »

I specifically registered an account to reply to you.

QBasic was my favorite language growing up. The one I really got for the first time. I started really young. I was 6 or 7 when I started using QBasic.. I'm 23 now.

I fixed a HUGE bug in your program.

I'll help you get your code to jump but I've got to go to bed here soon.. it's 5:43 A.M.

I'll post the bug fix here in a minute.
Lanlost
Newbie
Posts: 5
Joined: Tue May 06, 2008 4:38 am

On that

Post by Lanlost »

First of all, don't listen to what he said.

Having bad graphics has nothing to do with not being able to notice over simplified physics.

A constant rate isn't too bad. If you put some a small amount of 'hang time' like he said, it will appear to be accurate enough.

You don't want to use the timer function. You need a main game loop that is timed.. not just a specific thing. Using the timer commands won't be accurate enough.


Sorry.. I fell asleep.. I'll let you know tomorrow.
Lanlost
Newbie
Posts: 5
Joined: Tue May 06, 2008 4:38 am

Re: Making my sprite jump

Post by Lanlost »

This is a rehaul of your code..
I changed the format so you'll probably have to paste the whole damn thing into a text editor.

It doesn't add jumping.. but it does fix a major bug.

For some reason you had the boundary set to 16 for ToonX. It should have been 20 and I was trying to figure it out and made all kinds of debug code to figure out why the player didn't seem to collide with anything.

It made a new key that adds a block right where your player is..
strangly enough.. even though I was at like 10, 10 it would place the block at 5, 3 or some other strange number (even though I was using ToonX and ToonY).

You see... you had all of the background sprites drawing correctly.. but you didn't have the player sprite corresponding to the background because it had a different size.

I also added a bunch of new commands.

If you hit * now it will display debug info in every direction

(Such as:
Result
-------
2 2 1
2 =) 2
1 1 1

If there are three ground blocks below you and one to the top right.

If you hit Insert now it puts you into a no-clip mode where you can move through blocks (but not off the screen) .. once you are in this mode you can hit Page-Up and Page-Down to cycle through blocks. You can basically change the level.

You can just hit end to get out of this mode.

.. I think that's it.

Here you go. I will figure out a way to add jumping for you. You'll need to have the screen update more often.. or even better just do some dirty rectangle drawing or change only what moves.

I passed out at the keyboard.. sorry if this doesn't make too much sense.
.. Going back to bed.

Code: Select all

DECLARE SUB LoadGraphics ()
DECLARE SUB DrawScreen ()

' Edited by Lanlost
REM game

COMMON SHARED ToonX, ToonY, OldToonX, OldToonY, Press, XSV
DIM SHARED toon(50), TOONSH(50)
DIM SHARED sprite1(50), SPRITE2(50), SPRITE3(50)               'DIM ARRAY
DIM SHARED Map1(30, 15)

SCREEN 13
CLS

XSV = 1
ToonX = 17
ToonY = 12
OldToonX = ToonX
OldToonY = ToonY

' For when you add more sprites.
UpperBlockLimit = 3
LowerBlockLimit = 1
 
LoadGraphics

DO

'Controls
Press = INP(96)

IF Press = 75 AND Map1(ToonX - 1, ToonY) <> 1 THEN    ' Left Arrow
        IF ToonX > 1 THEN ToonX = ToonX - 1
END IF

IF Press = 77 AND Map1(ToonX + 1, ToonY) <1> 1 THEN ToonY = ToonY - 1           ' Until Jump Works ;-)
END IF

IF Press = 80 AND Map1(ToonX, ToonY + 1) <1> LowerBlockLimit THEN Map1(ToonX, ToonY) = Map1(ToonX, ToonY) - 1
                DrawScreen
        END IF

        'Allow you to move into blocks unless you are at the edge of screen
        IF TempPress = 75 THEN    ' Left Arrow
                IF ToonX > 1 THEN ToonX = ToonX - 1
                DrawScreen
        END IF

        IF TempPress = 77 THEN    ' Right Arrow
                IF ToonX <20>= 14 THEN ToonY = 13
END IF

IF Press = 55 THEN ' * Key shows area around you.
LOCATE 1, 1: PRINT " Results:"
LOCATE 2, 1: PRINT " --------"
LOCATE 3, 1: PRINT Map1(ToonX - 1, ToonY - 1); Map1(ToonX, ToonY - 1); Map1(ToonX + 1, ToonY - 1)
LOCATE 4, 1: PRINT Map1(ToonX - 1, ToonY); " "; CHR$(1); " "; Map1(ToonX + 1, ToonY)
LOCATE 5, 1: PRINT Map1(ToonX - 1, ToonY + 1); Map1(ToonX, ToonY + 1); Map1(ToonX + 1, ToonY + 1)
END IF

IF OldToonX <> ToonX OR OldToonY <> ToonY OR Redraw = 1 THEN
        DrawScreen
END IF

LOOP UNTIL Press = 1 'Esc key

DATA 07,07,07,07,07,07,08,08,07,07,07,07,07,07,07
DATA 07,06,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,06,06,06,06,08,08,08,08,08,08,08,08,08
DATA 07,06,06,06,06,06,08,08,08,08,08,08,08,08,08
DATA 07,08,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,08,08,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,08,08,08,08,08,06,06,06,06,06,06,06,06
DATA 07,06,06,08,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06

DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03 
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03



DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03   
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,02,02,03,03,03,03,03,03
DATA 03,03,03,03,03,03,02,02,02,02,03,03,03,03,03
DATA 03,03,03,03,03,02,02,02,02,02,02,03,03,03,03
DATA 03,03,03,03,02,02,02,02,02,02,02,03,03,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,03,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,03,02,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03
DATA 02,02,02,02,02,02,02,02,02,02,02,02,02,02,02




DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,1,2,2,2,2,2,3,3,2,3,3,2,2,2,2,2,2,2,2,2,2,2,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1



DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,01,01,01,01,01,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,01,00,00,00,00,00,01,00,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,00,01,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,01,00,00,00,00,01,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,01,01,01,01,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00


DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,001,001,001,001,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,255,001,255,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,001,001,001,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1

' Screen Drawing
SUB DrawScreen

OldToonX = ToonX
OldToonY = ToonY
Redraw = 0

FOR x = 1 TO 21
FOR y = 1 TO 15
IF Map1(x, y) = 1 THEN PUT (x * 15 - 15, y * 13 - 13), sprite1, PSET
IF Map1(x, y) = 2 THEN PUT (x * 15 - 15, y * 13 - 13), SPRITE2, PSET
IF Map1(x, y) = 3 THEN PUT (x * 15 - 15, y * 13 - 13), SPRITE3, PSET
NEXT: NEXT

PUT (ToonX * 15 - 15, ToonY * 13 - 13), TOONSH, AND
PUT (ToonX * 15 - 15, ToonY * 13 - 13), toon, OR

'LOCATE 1, 1: PRINT "X,Y: "; ToonX; ToonY


END SUB

SUB LoadGraphics

FOR y = 1 TO 13                               'LOAD BRICK
FOR x = 1 TO 15
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), sprite1

FOR y = 1 TO 13                               'LOAD SKY
FOR x = 1 TO 15
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE2


FOR y = 1 TO 13                               'LOAD BUSH
FOR x = 1 TO 15
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE3

CLS
                                              'MAP
FOR y = 1 TO 15
FOR x = 1 TO 30
READ Map1(x, y)
NEXT: NEXT

CLS

FOR y = 1 TO 20                               'LOAD TOON
FOR x = 1 TO 20
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), toon


FOR y = 1 TO 20                               'LOAD TOON SHADOW
FOR x = 1 TO 20
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), TOONSH


FOR y = 1 TO 15
FOR x = XSV TO XSV + 20
IF Map1(x, y) = 1 THEN PUT (x * 15 - XSV * 15, y * 13 - 13), sprite1
IF Map1(x, y) = 2 THEN PUT (x * 15 - XSV * 15, y * 13 - 13), SPRITE2
IF Map1(x, y) = 3 THEN PUT (x * 15 - XSV * 15, y * 13 - 13), SPRITE3
NEXT: NEXT

PUT (ToonX * 15 - 15, ToonY * 13 - 13), TOONSH, AND
PUT (ToonX * 15 - 15, ToonY * 13 - 13), toon, OR

END SUB


Lanlost
Newbie
Posts: 5
Joined: Tue May 06, 2008 4:38 am

What the hell?

Post by Lanlost »

Uh.. I only have a minute.. but... I noticed... that... the code tag.. doesn't exactly format everything correctly. In fact, lot's of stuff is different than what I actually pasted from.

Why, for instance, does it change IF something <> 1 to If something <1> 1?

Also.. I had group of code that entirely got erased and a "DrawScreen" placed in .. the complete wrong place. I'm looking at the code I pasted from.. I thought I just these bugs and didn't notice them because I was tired

Let's try again..

edit: Ok, I previewed it.. Sure enough, using

Code: Select all

 screws it up. I thought that was the point of it?
I'm going to paste it without the code tag.. it shouldn't be a problem since it's just QBasic..

If not.. you can compare it to actual file (should be the same... should be)
at <a href="http://home.columbus.rr.com/lanlost/jump.txt"> Jump.TXT </a> <br>  <a href="http://home.columbus.rr.com/lanlost/jump.bas"> Jump.bas</a>

They are the same, for some reason the .bas didn't format correctly as a text file.

What is the world coming to? Why can't a (bad ass) man upload a single file in any format?

Why?

I'll leave now


DECLARE SUB LoadGraphics ()
DECLARE SUB DrawScreen ()

' Edited by Lanlost
REM game

COMMON SHARED ToonX, ToonY, OldToonX, OldToonY, Press, XSV
DIM SHARED toon(50), TOONSH(50)
DIM SHARED sprite1(50), SPRITE2(50), SPRITE3(50)               'DIM ARRAY
DIM SHARED Map1(30, 15)

SCREEN 13
CLS

XSV = 1
ToonX = 17
ToonY = 12
OldToonX = ToonX
OldToonY = ToonY

' For when you add more sprites.
UpperBlockLimit = 3
LowerBlockLimit = 1
 
LoadGraphics

DO

'Controls
Press = INP(96)

IF Press = 75 AND Map1(ToonX - 1, ToonY) <> 1 THEN    ' Left Arrow
        IF ToonX > 1 THEN ToonX = ToonX - 1
END IF

IF Press = 77 AND Map1(ToonX + 1, ToonY) <1> 1 THEN ToonY = ToonY - 1           ' Until Jump Works ;-)
END IF

IF Press = 80 AND Map1(ToonX, ToonY + 1) <1> LowerBlockLimit THEN Map1(ToonX, ToonY) = Map1(ToonX, ToonY) - 1
                DrawScreen
        END IF

        'Allow you to move into blocks unless you are at the edge of screen
        IF TempPress = 75 THEN    ' Left Arrow
                IF ToonX > 1 THEN ToonX = ToonX - 1
                DrawScreen
        END IF

        IF TempPress = 77 THEN    ' Right Arrow
                IF ToonX <20>= 14 THEN ToonY = 13
END IF

IF Press = 55 THEN ' * Key shows area around you.
LOCATE 1, 1: PRINT " Results:"
LOCATE 2, 1: PRINT " --------"
LOCATE 3, 1: PRINT Map1(ToonX - 1, ToonY - 1); Map1(ToonX, ToonY - 1); Map1(ToonX + 1, ToonY - 1)
LOCATE 4, 1: PRINT Map1(ToonX - 1, ToonY); " "; CHR$(1); " "; Map1(ToonX + 1, ToonY)
LOCATE 5, 1: PRINT Map1(ToonX - 1, ToonY + 1); Map1(ToonX, ToonY + 1); Map1(ToonX + 1, ToonY + 1)
END IF

IF OldToonX <> ToonX OR OldToonY <> ToonY OR Redraw = 1 THEN
        DrawScreen
END IF

LOOP UNTIL Press = 1 'Esc key

DATA 07,07,07,07,07,07,08,08,07,07,07,07,07,07,07
DATA 07,06,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,06,06,06,06,08,08,08,08,08,08,08,08,08
DATA 07,06,06,06,06,06,08,08,08,08,08,08,08,08,08
DATA 07,08,06,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,08,08,06,06,06,08,08,06,06,06,06,06,06,06
DATA 07,06,08,08,08,08,08,06,06,06,06,06,06,06,06
DATA 07,06,06,08,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06
DATA 07,06,06,06,08,08,06,06,06,06,06,06,06,06,06

DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03 
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03



DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03   
DATA 03,03,03,03,03,03,03,03,03,03,03,03,03,03,03
DATA 03,03,03,03,03,03,03,02,02,03,03,03,03,03,03
DATA 03,03,03,03,03,03,02,02,02,02,03,03,03,03,03
DATA 03,03,03,03,03,02,02,02,02,02,02,03,03,03,03
DATA 03,03,03,03,02,02,02,02,02,02,02,03,03,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,03,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,03,03,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,03,02,02,02,02,02,02,02,02,02,02,02,03,03
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03
DATA 03,02,02,02,02,02,02,02,02,02,02,02,02,02,03
DATA 02,02,02,02,02,02,02,02,02,02,02,02,02,02,02




DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,1,2,2,2,2,2,3,3,2,3,3,2,2,2,2,2,2,2,2,2,2,2,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1



DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,01,01,01,01,01,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,01,00,00,00,00,00,01,00,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,00,01,00,00,00,00,00,00,01,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,01,00,00,00,00,01,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,01,01,01,01,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00


DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,001,001,001,001,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,255,001,255,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,001,255,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,255,255,001,255,255,255,255,255,255
DATA 255,255,255,255,255,255,001,255,255,255,255,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,001,001,001,001,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1
DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,1,1

' Screen Drawing
SUB DrawScreen

OldToonX = ToonX
OldToonY = ToonY
Redraw = 0

FOR x = 1 TO 21
FOR y = 1 TO 15
IF Map1(x, y) = 1 THEN PUT (x * 15 - 15, y * 13 - 13), sprite1, PSET
IF Map1(x, y) = 2 THEN PUT (x * 15 - 15, y * 13 - 13), SPRITE2, PSET
IF Map1(x, y) = 3 THEN PUT (x * 15 - 15, y * 13 - 13), SPRITE3, PSET
NEXT: NEXT

PUT (ToonX * 15 - 15, ToonY * 13 - 13), TOONSH, AND
PUT (ToonX * 15 - 15, ToonY * 13 - 13), toon, OR

'LOCATE 1, 1: PRINT "X,Y: "; ToonX; ToonY


END SUB

SUB LoadGraphics

FOR y = 1 TO 13                               'LOAD BRICK
FOR x = 1 TO 15
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), sprite1

FOR y = 1 TO 13                               'LOAD SKY
FOR x = 1 TO 15
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE2


FOR y = 1 TO 13                               'LOAD BUSH
FOR x = 1 TO 15
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), SPRITE3

CLS
                                              'MAP
FOR y = 1 TO 15
FOR x = 1 TO 30
READ Map1(x, y)
NEXT: NEXT

CLS

FOR y = 1 TO 20                               'LOAD TOON
FOR x = 1 TO 20
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), toon


FOR y = 1 TO 20                               'LOAD TOON SHADOW
FOR x = 1 TO 20
READ CLR
PSET (x, y), CLR
NEXT: NEXT
GET (1, 1)-(15, 13), TOONSH


FOR y = 1 TO 15
FOR x = XSV TO XSV + 20
IF Map1(x, y) = 1 THEN PUT (x * 15 - XSV * 15, y * 13 - 13), sprite1
IF Map1(x, y) = 2 THEN PUT (x * 15 - XSV * 15, y * 13 - 13), SPRITE2
IF Map1(x, y) = 3 THEN PUT (x * 15 - XSV * 15, y * 13 - 13), SPRITE3
NEXT: NEXT

PUT (ToonX * 15 - 15, ToonY * 13 - 13), TOONSH, AND
PUT (ToonX * 15 - 15, ToonY * 13 - 13), toon, OR

END SUB
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

?????????????????

Post by burger2227 »

Methinks you is talkin to yourself there kiddo...............
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Lanlost
Newbie
Posts: 5
Joined: Tue May 06, 2008 4:38 am

Yes.

Post by Lanlost »

Yes.. but, as it should be apparent, that won't stop me. He wanted help with his program .. so I helped him.
Post Reply