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 / Newbie sprites question

Author
Message
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 5th Jun 2003 02:15 Edited at: 5th Jun 2003 02:16
Hi,
I have am using the 'Beginners guide to DarkBasic Gme Programming' book to teach me DBPro. I am using the trial version (full one should arrive 2moro !) I am using one of their sample programs and can't get it to work! It is one of the fundamentally simple sprite displaying programs. However, the program won't compile saying that the sprite on line 23 doesn't exist!

`----------------------------------------------------------
`Beginner's Guide To DarkBASIC Game Programming
`Copyright (C)2002 Jonathan S. Harbour and Joshua R. Smith
`Chapter 11 - TransSprite Program
`----------------------------------------------------------

`Initialize the program
SET DISPLAY MODE 640, 480, 32
HIDE MOUSE
CLS

`Load background bitmap
LOAD BITMAP "background.bmp", 0

`Load the source bitmap file
LOAD BITMAP "F15.bmp", 1

`Grab image 1 from bitmap
GET IMAGE 1,0,0,300,300

`Draw the sprite
SPRITE 1,170,90,1
paste sprite 1, 0, 0

`Wait for keypress
WAIT KEY

END

background.bmp and F15.bmp are in the right directory. What's going on? The book says I should see a plane on top of a pretty background! If I can't understand this I'm not gonna do to well!

P.S. How do I use the code snippet thingy on these forums?

Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 5th Jun 2003 02:40
The below code works for me.

I hear and I forget. I see and I remember. I do and I understand.
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 5th Jun 2003 02:48 Edited at: 5th Jun 2003 02:52
Not that thats helpful but thanks anyway. I have been trying to sort out sprites for hours now....i'm starting to get paranoid that i'm an idiot....could it be a problem with my the demo compiler (although, they always say a crap workman always blames his tools....)



EDIT: Actually, I just clesed the program, started a new project and pasted the above code in. What's happening is that the the program compiles, the background is shown but no sprite! :-s

Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 5th Jun 2003 04:57
In this instance you are quite right to blame the tools - I really wish that DBS would take down that demo from their web page.

There's so many bugs in it that it scares off more users than it encourages and the people who have to deal with the mess are us forum dwellers.

So to any DBS staff who read this, "Ye gods, isn't it about time you threw that darn file away, if you can't for some reason make a new demo then have no demo at all! That one SUCKS!".

*phew* i'm beginning to loose my cool talking about that wretched demo... I need a life. No wait, it's not my fault. The demo really is that bad!

Thankfully the full version is whole lot better.

Pneumatic Dryll
CloseToPerfect
23
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 5th Jun 2003 06:11
I don't know how DB does things, but for DBpro I can make this right for you, DB code is not 100% compatible with DBpro. I tried to comment it for you. In general stay away from bitmaps unless you have a bitmap with several images you want to cut up into smaller images, but even that can be done easier with images.

Bitmaps in DBpro are sections of video memory on your video card, images are stored in your ram. this is different then DB.

SET DISPLAY MODE 640, 480, 32
HIDE MOUSE
CLS

'sprite in pro are 3d planes, try to set them befor use
set sprite 1,0,1


`Load background bitmap
`LOAD BITMAP "background.bmp", 0
load image "background.bmp", 2, 1

`Load the source bitmap file
`LOAD BITMAP "F15.bmp", 1

remstart
`you must switch to bitmap 1 if you want to get a image from it
set current bitmap 1

`Grab image 1 from bitmap
GET IMAGE 1,0,0,300,300
remend

`but it's easier to just load a image then load bitmap,switch bitmaps, and get image

load image "F15.bmp", 1, 1
`the 2nd 1 is a texture flag to not use mip mapping and will make a image clearer

`Draw the sprite
SPRITE 1,170,90,1

`paste sprite 1, 0, 0 this only draws the image of sprite 1 which is your jet.
paste image 2,0,0
` now this will paste the background image

`Wait for keypress
WAIT KEY

END
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 5th Jun 2003 12:26 Edited at: 5th Jun 2003 15:26
Thanks close to perfect! I got it to work using just the image command and not using a bitmap and the GET IMAGE command. I hope it's just a buggy demo compiler thats the cause of the other problem. From what PD was saying, it sounds like it might be.

Update:
Full version arrived today and everything seems to work OK. If I didn't have so much faith in the language...the demo could have caused me to give though. SORT IT OUT!

Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
CloseToPerfect
23
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 6th Jun 2003 02:16
Well you do have to keep in mind that that was Dark Basic code for the book and now your using Dark Basic Pro. There not the same and some of the command that are the same work different, for example the whole sprite section is now completly 3D and functions different then in Dark Basic, and Dark Basic Pro's sprites are much faster, but don't have pixel perfect collision. There are several commands in Dark Basic that are not in Dark Basic Pro, so just keep that in mind when using Dark Basic code with Dark Basic Pro.
CTP
Kangaroo2
23
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 6th Jun 2003 07:27
Pneu - I agree with u on the demo, I would never have bought Pro if I'd have based it on the demo, but thankfully I did and the full version's great!

Bunnies aren't just cute like everybody supposes, They got them hoppy legs & twitchy little noses,
And what's with all the carrots? What do they need such good eyesight for anyway?
The Darthster
23
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 6th Jun 2003 23:04
That's odd, the demo worked fine as far as I could see, I even made Quake III Arena and ripples 'n' lights with it.

Once I was but the learner,
now, I am the Master.
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 6th Jun 2003 23:31
Quote: "I even made Quake III Arena and ..."

I'm pretty sure Quake III Arena was written by I.D.

Pneumatic Dryll
The Darthster
23
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 6th Jun 2003 23:37
You'd think so, wouldn't you...

Once I was but the learner,
now, I am the Master.

Login to post a reply

Server time is: 2026-07-11 11:05:11
Your offset time is: 2026-07-11 11:05:11