April 22, 2025, 09:49:33 pm
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
Forever
Login with username, password and session length
News
: Want to see a specific Tutorial? ASK!
Home
Help
Search
Arcade
Links
Staff List
Login
Register
Game Not Completely working,author unknown
Weekly Qbasic and Qb64 Lesson Topics
>
Forum
>
General Category
>
General QB64 Forum
>
Game Not Completely working,author unknown
Pages: [
1
]
2
« previous
next »
Print
Author
Topic: Game Not Completely working,author unknown (Read 1504 times)
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Game Not Completely working,author unknown
«
on:
April 05, 2011, 08:52:47 pm »
I saw this on yahoo questions, and liked the idea, the author did not post his name,...was asking about why it did not work,...I remarked out alot of lines, so it would sort of run,..Can any one do anything with it ?
Code:
REM 'I found this in yahoo questions, he wnated some help in why it did not run right
'but I did not get the name of the poster, I start getting the problem on line 123
'but enough runs that it looks interesting, also I remarked out a lot of lines,
'so it would run, sort of,...we could mayne make it into something,...if anyone is
'interested, and whoever started it, sorry I just did not know your name,but if you
'claim it, I won't argue, I'll give credit where it is due.Thanks for the start
SCREEN 12
DIM stack(240000) AS INTEGER
DIM SHARED c%, color%, ct, bn
LOCATE 14, 31: PRINT "Let's stack a tower"
SLEEP 1
LOCATE 15, 18: INPUT "Would you like to read the instuctions (y/n)"; i$
IF i$ = "y" OR i$ = "Y" THEN CALL instruct
LOCATE 16, 36: PRINT "Loading..."
SLEEP 3
CLS
CALL background
c% = -45
color% = 4
bn = 456
'claw
CALL background
'blank stack
GET (250, 445)-(399, 100), stack()
CLS
claw: CALL background
c% = c% + 1
IF c% > 665 THEN c% = -25
LINE (c%, 15)-(c% + 3, 40), 7, BF
LINE (c% - 20, 40)-(c% + 23, 45), 4, BF
LINE (c% - 10, 45)-(c% - 20, 65), 4, BF
LINE (c% + 13, 45)-(c% + 23, 65), 4, BF
'block
LINE (c% - 8, 47)-(c% + 11, 64), color%, BF
CALL waiting
CLS
IF INKEY$ = " " THEN CALL blockdrop ELSE GOTO claw
CALL colors
GOTO claw
SUB background
'exit
IF INKEY$ = "e" THEN END
'house 1
LINE (0, 500)-(124, 330), 4, BF
LINE (21, 360)-(41, 385), 0, BF
LINE (83, 360)-(103, 385), 0, BF
LINE (21, 420)-(41, 445), 0, BF
LINE (83, 420)-(103, 445), 0, BF
'exit
IF INKEY$ = "e" THEN END
'house 2
LINE (125, 500)-(249, 200), 14, BF
LINE (145, 240)-(165, 265), 0, BF
LINE (207, 240)-(227, 265), 0, BF
LINE (145, 300)-(165, 325), 0, BF
LINE (207, 300)-(227, 325), 0, BF
LINE (145, 360)-(165, 385), 0, BF
LINE (207, 360)-(227, 385), 0, BF
LINE (145, 420)-(165, 445), 0, BF
LINE (207, 420)-(227, 445), 0, BF
'exit
IF INKEY$ = "e" THEN END
'house 3
LINE (250, 500)-(374, 250), 1, BF
LINE (269, 290)-(289, 315), 0, BF
LINE (331, 290)-(351, 315), 0, BF
LINE (269, 350)-(289, 375), 0, BF
LINE (331, 350)-(351, 375), 0, BF
LINE (269, 410)-(289, 435), 0, BF
LINE (331, 410)-(351, 435), 0, BF
'exit
IF INKEY$ = "e" THEN END
'house 4
LINE (375, 500)-(505, 200), 6, BF
LINE (465, 240)-(485, 265), 0, BF
LINE (395, 240)-(415, 265), 0, BF
LINE (465, 300)-(485, 325), 0, BF
LINE (395, 300)-(415, 325), 0, BF
LINE (465, 360)-(485, 385), 0, BF
LINE (395, 360)-(415, 385), 0, BF
LINE (465, 420)-(485, 445), 0, BF
LINE (395, 420)-(415, 445), 0, BF
'exit
IF INKEY$ = "e" THEN END
'house 5
LINE (506, 500)-(640, 325), 2, BF
LINE (595, 360)-(615, 385), 0, BF
LINE (526, 360)-(546, 385), 0, BF
LINE (595, 420)-(615, 445), 0, BF
LINE (526, 420)-(546, 445), 0, BF
'exit
IF INKEY$ = "e" THEN END
'tower
'platform
LINE (347, 450)-(355, 490), 5, BF
LINE (269, 450)-(277, 490), 5, BF
LINE (259, 445)-(365, 460), 5, BF
'claw line
LINE (0, 15)-(640, 15)
'stack
'PUT stack(), XOR
'exit
IF INKEY$ = "e" THEN END
END SUB
SUB blockdrop
bn = bn - 18
'falling
by% = 47
22 LINE (c% - 8, by%)-(c% + 11, by% + 17), color%, BF
by% = by% + 2
CALL waitblock
CLS
CALL background
IF by% > bn - 5 THEN LINE (c% - 8, bn)-(c% + 11, bn - 17), color%, BF: GOTO 5
GOTO 22
'claw re-draw
5 c% = -45
'stack
GET (250, 445)-(399, 100), stack()
END SUB
SUB instruct
CLS
LOCATE 10, 8: PRINT "The goal of the game is simple. Just stack the blocks to the top."
LOCATE 11, 6: PRINT "When the crane is over the base plate, hit spacebar to drop the block."
LOCATE 12, 4: PRINT "If you miss the last block entirely, you will lose one of your three lives."
LOCATE 13, 12: PRINT "If you hit the last block exactly, you score extra points."
LOCATE 14, 6: PRINT "To exit the game, hit the spacebar then press 'e' as the block is falling."
LOCATE 15, 29: PRINT "Press any key to continue."
SLEEP
END SUB
SUB waiting
FOR t = 1 TO 350000
NEXT t
FOR t = 1 TO 350000
NEXT t
FOR t = 1 TO 350000
NEXT t
END SUB
SUB waitblock
FOR t = 1 TO 320000
NEXT t
FOR t = 1 TO 320000
NEXT t
FOR t = 1 TO 320000
NEXT t
END SUB
SUB colors
RANDOMIZE TIMER
color% = INT(RND * 15 + 1)
IF color% = 0 THEN color% = color% + 2
IF color% = 1 THEN color% = color% + 1
END SUB
One thing I like is it dose not need any additional image files,etc, it runs
useng qb64, includeing the graphics....also If you recognize the code, and are the author, speak up, so I can give credit whre it is due.
from Garry
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
OlDosLover
Guest
Re: Game Not Completely working,author unknown
«
Reply #1
on:
April 05, 2011, 09:48:20 pm »
Hi all,
When i run it i get an run time error when the block drops to the pink stool. Its possible we could do something with it. It is difficult to follow another author's logic in how they lay out their game. It may be easier to just redo it in QB64. I gather that you keep dropping blocks until a certain height is reached.
Perhaps Garry you could try to figure out the idea behind it and post an explanation of it. Or we could simply remodel it to our idea if you like.
OlDosLover
Report Spam
Logged
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Re: Game Not Completely working,author unknown
«
Reply #2
on:
April 05, 2011, 10:29:41 pm »
OK, well, I guess, I'll see, when I am bored, and canīt think of anything else to do ! harr..., but thats about it, to start, my method,if I have one, is elimante everything remarked out,(well almost everything,some remrks identify, the code,and what it is for,) then like you say, try to make it just stack the blocks as high as you can,....
And or it gives something to talk about,...one could go into makeing it wher if they are not stacked correctly it falls over,and crashes,...and things
P.S, I did try unseens smfl, the first versions work,...the most recent I am have trouble with, but that is a whole different topic,.from Garry
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
Dustie Bear
Full Member
Posts: 115
Re: Game Not Completely working,author unknown
«
Reply #3
on:
April 07, 2011, 08:34:40 am »
Hi
The variable DIM stack(240000) AS INTEGER
Should be Shared
DIM SHARED stack(240000) AS INTEGER
That got rid of one error. That was simple to find.
Havent looked for other errors yet.
Is this copy the same as when you got it or have you
edited it some. seems some parts are missing,(unfinished)
If you have edited it some Id like to see the orignal.
Dustie
Report Spam
Logged
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Re: Game Not Completely working,author unknown
«
Reply #4
on:
April 07, 2011, 06:22:02 pm »
Line 105, not counting all the remarks before the screen 12 statement, or in other words, starting from screen 12, is line 1.
Code:
'PUT stack(), XOR
I remarked it out,, but did not change anything, else it would not run at all (syntex error).
The way the poster had put his question, that would be expected, as he said he had just started, so yes it was unfinished,...thanks for ponitig out the dim stack, should be dim shared,.....
As I learn more I may be able to spot things, to that are incorrect,...
like the PUT stack (),XOR, that not only got a syntexerror, but dose not look right, but I still don't know, I guess it shoud be X,Y or something,..?
from Garry
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
OlDosLover
Guest
Re: Game Not Completely working,author unknown
«
Reply #5
on:
April 07, 2011, 06:28:56 pm »
Hi all,
PUT uses PSET by default i think. This is really an action verb like the others. PSET , PRESET, XOR, AND. When you add one of these verbs to the end of a PUT statement then a different type of result occurs. The colors and background change somewhat compared to the other action verb result.
For example with masking you have to use the verbs in the right sequence to make the image be placed over your background without seeing the added images true background.
OlDosLover.
«
Last Edit: April 07, 2011, 08:48:30 pm by OlDosLover
»
Report Spam
Logged
Dustie Bear
Full Member
Posts: 115
Re: Game Not Completely working,author unknown
«
Reply #6
on:
April 07, 2011, 08:35:01 pm »
Hi
I think I remember Pset being default to but it might save a few headaches to just use it anyway. lol
His program seems to run fine , the block that you drop falls and even stops as if there
were blocks below it as they pile up, so he hasnt gotten that part finished yet..
When you use XOR, OR, AND you are mixing or blending (
for lack of better words
) the
colors from the object in the var with the ones on the screen where you are putting that
object. thats how you can make transparent parts of the object or just make
it look goofy. Lol
Each pixel gets treated something like this. Its binary Math
Imagine the top binary number is a pixel on the screen
and the one in the center represents a pixel in the variable,
the result will be the bottom binary number just like in regular math only its binary.
This one is an AND
100110 ' Pixel to be placed on screen
and 101101 ' Pixel on screen where pixel will be placed
equals 100100 , Resulting pixel on screen
_______________
This is an OR
100110
or 101101
equals 101111 If either one or both in each column is 1 then the result is 1
_______________
This is an XOR
100110
XOR 101101
equals 001011 With XOR you only bring down a 1 if both are differant.
That is how PUT uses (AND OR XOR) PSET just puts the pixel on the screen
as it actualy is. it does no comparing of the pixel and the one on the screen.
binary math is explained in the wiki.
There are tons of info online too.
Dustie
«
Last Edit: April 07, 2011, 08:38:47 pm by Dustie Bear
»
Report Spam
Logged
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Re: Game Not Completely working,author unknown
«
Reply #7
on:
April 07, 2011, 11:01:53 pm »
Quote
he variable DIM stack(240000) AS INTEGER
Should be Shared
DIM SHARED stack(240000) AS INTEGER
I did this, on the DIM shared, but below
Now I get expected variable/value before operator, I know this is going to sound dense, but I still do not know, which is the operator,...?and the what should the variable be ? Without this line it runs ok, but the blocks don't stack up,...
Code:
PUT stack(), XOR
Thanks Dusty, on your explanation, if the numbers 100110
101101
001011, are what I should use, do I put them here ? PUT stack (100110), XOR
from Garry
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
OlDosLover
Guest
Re: Game Not Completely working,author unknown
«
Reply #8
on:
April 08, 2011, 03:08:17 pm »
Hi All,
Garry you dont use those 001011 numbers. Dustie was showing through numbers mathematically what happens. Lets look at the line that is erroring out
Quote
Put Stack(0), XOR
If you check the wiki you will find to use put you need some screen co-ordinates of where to place it.
put (100,100),Stack(),XOR
This will work but i made those (100,100) figures up. The programmer somewhere uses a get
Quote
GET (250, 445)-(399, 100), stack()
and trying PUT (250, 445), stack(), XOR brings about another error.
The statement DIM SHARED stack(240000) AS INTEGER is a BIG number, Thats 240,000!!. Thats probably enough to capture the whole screen. In theory the author drops a box and we ,over time, make a stack going up on the screen visually. He wants that stack to show up all the time , and as its not part of the background it must be redrawn and added to. So where do the (X,Y) start?
My idea , with qb64, is to capture the entire screen below the claw and box in a rectangle across the screen and to the bottom of the screen. This would show all of the dropped boxes wherever they landed!
To do this you'd need 2 dims .1] shows the background + boxes already dropped 2] The present box that is dropping.
Or ,assuming only boxes that are dropped and are stacking are shown, 1 dim to capture that stack. With this idea the GET would have to be topish part of the screen with the Y asis.
I'd need to print this out (printer down atm) and study it a bit. To me it would be easier to REDO it in QB64.
OlDosLover
«
Last Edit: April 08, 2011, 03:27:23 pm by OlDosLover
»
Report Spam
Logged
OlDosLover
Guest
Re: Game Not Completely working,author unknown
«
Reply #9
on:
April 08, 2011, 03:36:52 pm »
Hi all,
Tried this
Quote
PUT (0, 0), stack(0), XOR
and it works but is at wrong place. Try mucking around with the (0,0) to arrive at the correct screen location. Its obvious that he captures from the stool top and upward. What i dont understand is the lowest box is erased once the next top box is placed.
I'd do this so diffeently. Id use 2 dims. 1 to capture the stool area, 2 to show the current box moving across the screen on the claw.
OlDosLover.
Report Spam
Logged
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Re: Game Not Completely working,author unknown
«
Reply #10
on:
April 08, 2011, 06:44:20 pm »
Quote from: OlDosLover on April 08, 2011, 03:36:52 pm
Hi all,
Tried this
Quote
PUT (0, 0), stack(0), XOR
and it works but is at wrong place. Try mucking around with the (0,0) to arrive at the correct screen location. Its obvious that he captures from the stool top and upward. What i dont understand is the lowest box is erased once the next top box is placed.
I'd do this so diffeently. Id use 2 dims. 1 to capture the stool area, 2 to show the current box moving across the screen on the claw.
OlDosLover.
Ok on this,..it makes sense,,...the other things, like another dim also, make sense, so any way ,now I understand, it is looking for some
kind of variable/value, in the PUT (0,0), stack (0) XOR
In relation to re-do, thats up to you, If you want, but I think it would be better, when you do that, put in the lessons, as the correct way,...
or evn a tetris, version would be better,...What do you think ?,...but I don't want to distract you from the PacMan!...
from Garry
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
OlDosLover
Guest
Re: Game Not Completely working,author unknown
«
Reply #11
on:
April 08, 2011, 06:51:55 pm »
Hi all,
Garry i think this would be a very easy redo in QB64. Id screen capture the graphics to a bmp file. From then on it would be VERY easy to rwrite. There is NO CORRECT way! Thats one of the bueaty's of programming. From your remarks you can follow how i think about it. That means we think similar on this subject. The author had his own idea which is not very obvious from reading his code. What he tried to do can be done that way , its probably easier to use another idea of implementing it and hopefully more people will understand it. This is one of the reason's i want multiple examples from people on this site. More ways to do it creates a bigger pool for all to study from.
OlDosLover.
Report Spam
Logged
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Re: Game Not Completely working,author unknown
«
Reply #12
on:
April 08, 2011, 07:04:36 pm »
Ok, that sound ok, what I ment though, by "correct", is when each part,as it is made, or if it is simple, all in one post, but code that works, all though, a good part of this works, not all of it, so at this point,it is not correct,...
As far as variations useing different techniques, thats good, if they work,...
I will be looking forward to seeing what you come up with,...
from Garry
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
Dustie Bear
Full Member
Posts: 115
Re: Game Not Completely working,author unknown
«
Reply #13
on:
April 10, 2011, 02:42:20 pm »
Hi guys.
This isnt that hard guys.
you know it works partualy, So why arent you looking for the VAR that controls the magnet falling.
it gets incremented when it is falling so it will be a Y value, not an x value.
that shouldnt be to hard to find for you.
x always come before the y value. in qb that is, some screens in qb64 it would be decremented.
put those x,y in where the (0,0) is and you have it, not hard at all.
isnt be hard to find that var.
when the thing stops falling the box will be there by the put.
the (0,0) has to be a value of an x,y) value as it has to change each time the box is dropped so it is be a var. not a const.
should like PUT (X,Y), stack,xor not PUT (0,0), stack (0) XOR
what ever he named the var that falls.
If your still wanting to pursue it.
This program is very much like my arcade game exept the box is being dropped where my arcade game
has a ball that is being shoot and goes up, not down. LOL
Dustie
«
Last Edit: April 10, 2011, 03:23:59 pm by Dustie Bear
»
Report Spam
Logged
OlDosLover
Guest
Re: Game Not Completely working,author unknown
«
Reply #14
on:
April 10, 2011, 03:39:08 pm »
Hi all,
I'll leave this in your hands Dustie.
OlDosLover.
Report Spam
Logged
Pages: [
1
]
2
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Useful Information ,Rules,FAQs,LINKS,etc.
===> INTRODUCE Yourself
=> General QB64 Forum
=> MS DOS, FREE DOS, ANY DOS
-----------------------------
QB64 lessons and tutorials,Games
-----------------------------
=> Lesson Disussion
=> Weekly Lesson
=> Games
-----------------------------
TUTORIALS
-----------------------------
=> QB64 Tutorials
=> Text Adventure
=> QBasic Tutorials
=> Other Tutorials
-----------------------------
UNSEENS GDK+SFML Librarys
-----------------------------
=> Discussions on GDK+SFML
=> GDK+SFML Demos, and projects
-----------------------------
DEMOS
-----------------------------
=> Working QB64 Demos
=> QB64 Games
=> QB64 Programs You Are Proud Of.
=> Function + SUB Club
-----------------------------
OFF TOPIC,and Off The wall
-----------------------------
=> OffTopic and Off the Wall
Powered by
EzPortal
Loading...