Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DB Book Tutorial Sprite Animation not working.

Author
Message
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 22nd May 2003 18:53
Typed in directly from the DB beginner's guide to darkbasic game programming, chpater 11, program 1, 'LoadSprite' program.

It isn't working, so I loaded the dbpro edit off the cd-rom, however this one doesn't work, and I don't think I've made the mistake because the pre-compiled program of 'LoadSprite' doesn't do what it is supposed to do.

It is supposed to display a sprite on the screen but it doesn't, the source is provided below, and the sprite can be found at:
http://www.grinders.withernsea.com/ar/F15.bmp

Thanks in advance,
-Nilrem.
I hear and I forget. I see and I remember. I do and I understand.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 22nd May 2003 20:42
Anybody? Tis rather annoying this problem, I hope it's been typed in incorrectly and it isn't some kind of hardware dependant issue?

I hear and I forget. I see and I remember. I do and I understand.
Shining Moonblade
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 22nd May 2003 20:47
Is the bitmap 300 x 300 in size? If it's larger (or smaller) you're grabbing the wrong area to throw onto the screen. Try that.

Watashi no namae wa Zeroshin desu! Hashitekudasai!
Shining Moonblade
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 22nd May 2003 20:49
One other thing you could try: I don't think that bitmap has 32 bit depth. Try setting the resolution to 640 x 480 x 16.

Watashi no namae wa Zeroshin desu! Hashitekudasai!
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 22nd May 2003 21:19
It has 24 bit-depth (I'll try setting it to 16) and yes it is 300x300, I know people make mistakes, but if that is the problem I would've thought the book wouldn't have that mistake, saying that however, my c++ book had a ton of mistakes.

I hear and I forget. I see and I remember. I do and I understand.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 22nd May 2003 21:21
Still not working Moonblade with the below code.

I hear and I forget. I see and I remember. I do and I understand.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 23rd May 2003 01:31
Argh, hehe I cannot progress through the book... it's doing my, shall we say, 'nut-in'.

I hear and I forget. I see and I remember. I do and I understand.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 24th May 2003 18:57
No-one at all? Bah, I really cannot progress at all through the Beginner's book now...

Please someone?

I hear and I forget. I see and I remember. I do and I understand.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 24th May 2003 20:01
this might shed some light on the subject for you.

alter to suit your needs.




CloseToPerfect
23
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 24th May 2003 20:25 Edited at: 24th May 2003 20:27
all you neeed to do is use a SET CURRENT BITMAP 1 between LOAD BITMAP "F15.bmp", 1 and GET IMAGE 1,0,0,300,300 and then a SET CURRENT BITMAP 0 after that.

why?

because your loading a bitmap image into slot 1 and your grabbing a image from the screen which is slot 0, setting the working bitmap to 1 lets you get images or anything you want to do from bitmap 1 but after you do whatever you want from bitmap 1 you need to set it back to the active screen which is bitmap 0. clear? hope so. ask if not.

CTP

oh, but this is for DBpro I don't know what your using, I'll assume it's pro as this isn't the classic forum, I never used DBC so I don't know how it works
thedubdude
23
Years of Service
User Offline
Joined: 24th May 2003
Location: San Jose, Ca.
Posted: 25th May 2003 00:03
That does indeed fix the problem. I was having it also.

One other issue with the book examples. I copied them onto my hard disk and notice that they are all READ protected (check properties). Thus you can't modify them unless you un-read protect them. Furthermore, the executable is read protected, so if you just un-read protect the source modify it and try and execute it...your changes won't work...because the executable won't be overwritten. Either delete the excutable (ie. pyramid) or un-read protect it.

Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 02:27
I understand that CTP, thanks for the explanation, however I can still not get it to work, I know I'm doing something silly, but I can't pinpoint exactly what it is, so I've supplied the code below, if you could just fix it for me please?

Many thanks CTP.
-Nilrem.

I hear and I forget. I see and I remember. I do and I understand.
The Game
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United States
Posted: 26th May 2003 03:47
This code should help you out. To get rid of the bluescreen effect on this code look at the online DBPro tutorial here http://www.darkbasicpro.com/tutorials.php should be tutorial number 10

I am the game and I want to play.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 26th May 2003 08:24
glad to see my effort was a waist of time

Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 14:55
Indi, your way worked, thankyou a lot, however at a first glance it seemed rather intimidating/daunting, so I opted for the method that seemed easiest.

Anywho... thankyou everyone.

I hear and I forget. I see and I remember. I do and I understand.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 14:58
Hmmm.... The Game your code modification does not display the sprite at all... I would really like to see CTP's modification working.... CTP/Anyone?

I hear and I forget. I see and I remember. I do and I understand.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 15:03
Oh yeah, sorry forgot to add, but Indi, whilst your way works, I am working from the book and need to get image swapping (from bitmap's or whatever it is my first piece of code I posted is meant to do) so I need the code I posted to work because later on in the chapter/(s) I won't be able to get anything to work, *eep*

So once again, the code I need working is below; and the bitmap can be found at, http://www.grinders.withernsea.com/ar/F15.bmp

Thanks in advance once again.
-Nilrem

I hear and I forget. I see and I remember. I do and I understand.
The Game
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United States
Posted: 26th May 2003 16:35
I tested my code again and it worked for me..hmmm..When I tried your new code it didn't work but it did work when I took out the sync on and sync command.

I am the game and I want to play.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 16:37
Any reason why it won't work with the sync on and sync command?

I hear and I forget. I see and I remember. I do and I understand.
The Game
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United States
Posted: 26th May 2003 16:57
I believe the reason is because you are drawing to the screen first and then calling the sync command. When you use the syc command it copies the double buffer to the screen. Since you drew to the screen first and then called the sync command it was a blank screen you got because noting was put in the double buffer.

Look on page 331 of the book. It explains the sync command and how it works.

I am the game and I want to play.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 17:06
Thanks Game.

I hear and I forget. I see and I remember. I do and I understand.

Login to post a reply

Server time is: 2026-07-11 06:07:00
Your offset time is: 2026-07-11 06:07:00