John "krylar" Logsdon (learn to program)

BlitzPlus Forums/BlitzPlus Beginners Area/John "krylar" Logsdon (learn to program)

o-q(Posted 2009) [#1]
Hi all.
I'm working through this book, "Learn to programe 2d games in BlitzBasic" by John Logsdon.

And I keep hitting a problem....
The book says...
==============================================
;initialize Blitz Basic at 640x480.
Graphics 640,480

;While the user has NOT hit the Esc key.
While Not KeyHit(1)

;Clear the screen.
Cls

;Write out some text
Text 270,240,"Hello, Blitz Basic!"

;Wait for 250 milliseconds.
Delay(250)

;Clear the screen.
Cls

;Wait for 250 Milliseconds.
Delay(250)

;End of while not keyhit (1).
Wend

;End of Programe
End
==============================================

All fine and dandy, but no text!

Question is:

Is the book wrong?
Have I done something wrong?


Wiebo(Posted 2009) [#2]
the second CLS should be a Flip. you're clearing the screen twice.


o-q(Posted 2009) [#3]
Thankyou, so the book is wrong!
Dam, youd thought someone would check these things first!

Many thanks Wiebo.

I presume "Flip" is to flip the buffers?


Wiebo(Posted 2009) [#4]
That's exactly right. You're using a double buffered graphics mode.

Strange that this is wrong in the book. I've heard good things about it. But at least you now know that it can be wrong.


Yan(Posted 2009) [#5]
I believe the book was written with B2D in mind which writes to the front buffer by default.

That code would definitely have worked in B2D, so not really wrong. :o)

Does B+ write to the back buffer by default then?


David Boudreau(Posted 2009) [#6]
Hm I never noticed that in the book. I bought it to get a few more details about the side-scrolling method he uses which helped me. Btw you should also check the online articles (on the blitzcoder archive) he wrote, there is overlap with the book and some updates as well-- in fact there was quite a correction in an article he wrote (post book publishing to fix it), can't remember exactly now, maybe to do with loading in map ASCII files for a sidescroller. Also note that the book is mostly compatible with BlitzPlus but some small differences between languages, eg avoid using delay in your code (samples like this are fine of course, just to get stuff working etc). With BlitzPlus' lacking documentation I still refer to it from time to time, but searching through forums and quick and simple little test programs usually helps me find out what I need the most actually. The most glaring error about Krylar's book I always notice is the page numbers emphasizing the wrong number, eg page 46 OF 295 with 295 printed in large type on every single page.


Ginger Tea(Posted 2009) [#7]
Is the book wrong?
Have I done something wrong?


not saying its true in this case, but some old books intentionally bugged source code just to get you out of the habbit of copy+paste or going right to the last examples and hitting compile, its broken for a reason, you should be following whats written to understand the code on the page and on screne and pay attention enough to spot when things are wrong.

but if b2d acted differently to b3d letalone b+ then thats probably not a bug as such


o-q(Posted 2009) [#8]
Thaks for all the comments:

Where should the "flip" command go as a genral rule?


_PJ_(Posted 2009) [#9]
The flip should ideally be the last thing done. It's when all the drawing has been sdone (to the Back Buffer) and you then flip the buffer to the front (i.e. the ACTUAL DISPLAY ON-SCREEN) the only thing to do after the flip, is close the loop.

While blahblah ; START LOOP
DrawMy2DStuff
Flip
Wend



o-q(Posted 2009) [#10]
Many thanks, guys!


GfK(Posted 2009) [#11]
IIRC, that book had a monumental list of corrections on the now defunct Blitzcoder.com website. So if you hit any problems in future I wouldn't automatically assume its your fault. :)

I worked at Idigicon at the time it was published, and to my knowledge it was never proofread by anybody. So, that probably didn't help things along.


LineOf7s(Posted 2009) [#12]
http://membres.lycos.fr/blitzcoder/booksnafus.html

In defence of the book, regardless of how many errors there actually were, three published corrections doesn't exactly constitute "a monumental list".

Check out that link, donkeyoaty, just in case you have other issues that might be explained away by the corrections there.


Wiebo(Posted 2009) [#13]
I forgot that Blitz2D used to draw to the front buffer. So yeah, expect more changes from now on :) It will make you understand the code better though.


GfK(Posted 2009) [#14]
three published corrections doesn't exactly constitute "a monumental list".
There were way more than three errors in it. But even the three on that site shouldn't have slipped through.


Tobo(Posted 2009) [#15]
There are some good books for Blitz Plus, Blitz 3D and Blitz Max on Amazon.

All by the same guy I think.

Here's the Blitz Plus one

Tobo


schilcote(Posted 2009) [#16]
I leaned Blitz from the predecessor of that book. When I was 4. Very good book.


Nate the Great(Posted 2009) [#17]
I was just learning to read when I was 4 lol! I learned in 4th grade tho... on topic... I think any book, especially one for beginners should be proofread


GfK(Posted 2009) [#18]
I leaned Blitz from the predecessor of that book. When I was 4. Very good book.
So, how old are you now?

The first edition was published in May 2003, which would make you 9 years old if you bought it pretty much as soon as it was released. Younger if you bought it later.


schilcote(Posted 2009) [#19]
What? Game Programming For Teens? By Mannesh Sethi? I'm 13 right now, so we must be talking about different books. It wasn't that book exactly, it was the book that came before it.


GfK(Posted 2009) [#20]
What? Game Programming For Teens? By Mannesh Sethi? I'm 13 right now, so we must be talking about different books. It wasn't that book exactly, it was the book that came before it.
Well, that's the second edition, and its predecessor was the first edition.

So yes, we're talking about different books. Which one are you talking about?


Sauer(Posted 2009) [#21]
I leaned Blitz from the predecessor of that book. When I was 4.

You really like making that point, don't you?


schilcote(Posted 2009) [#22]
I am talking about ISBN 1-59200-068-1, Library of Congress catolouge card number 2003101215. The name of the book is "Game Programming for Teens", by Maneesh Sethi, Premier Press, part of the Premier Press Game Development Seires.


GfK(Posted 2009) [#23]
I am talking about ISBN 1-59200-068-1, Library of Congress catolouge card number 2003101215. The name of the book is "Game Programming for Teens", by Maneesh Sethi, Premier Press, part of the Premier Press Game Development Seires.

That's the first edition, published in 2003. It says so here:

http://www.amazon.com/Game-Programming-Teens-Maneesh-Sethi/dp/1592000681/ref=sr_11_1?ie=UTF8&qid=1234168546&sr=11-1

For you to have read that book when you were 4, would mean you could not possibly be older than 9 now.

So you either weren't 4, you're not 13 now, or you have some magical means of reading books before they've even been written.


Sauer(Posted 2009) [#24]
What can a four year old really learn from a programming book anyways? The brain isn't even fully developed to hold memories prior to the age of four I believe...

I'm with Gfk on this one.

I learned from Maneesh Sethi's book as well, at least to get started... it only covered basic principles, which was useful as a foundation, but the real learning came from practice, discussion here, and now school.


Dabhand(Posted 2009) [#25]
Remeber when Maneesh Sethi was on a internet tech show or something, bigging up his book and they had one of the programs from the book running on a pc beside the presenter and up popped a bug when the presenter was playing it! :)

Which he tried to fix there and then! lol

I think thats how it went, funny at the time! Hehehehe

Dabz


Sauer(Posted 2009) [#26]
He wrote a book about web design too, but his website is not designed by him and from the looks of it is all but dead now.

I could care less though, I got what I needed from his book to begin my programming hobby, and that's all that's really important.


Ginger Tea(Posted 2009) [#27]
on the whole 13 years old now 4 when the book came out being mathmatically wrong
well that would be 2000 when blitz was first released (for the pc)


John Blackledge(Posted 2009) [#28]

Remeber when Maneesh Sethi was on a internet tech show or something, bigging up his book and they had one of the programs from the book running on a pc beside the presenter and up popped a bug when the presenter was playing it! :)


Yeah, I remember that.
One of the first bits of video I saw on the web.
Ah - bless.


Luke111(Posted 2009) [#29]
Lol...
A buffer mess up...
BlitzBasic is too old. At least use BlitzPlus.
:)
Luke


okee(Posted 2009) [#30]
If you add
SetBuffer Frontbuffer()
after Graphics 640,480
it should do it,
never knew B+ wrote to the backbuffer as default
always use setbuffer backbuffer() as a habit