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.

Newcomers DBPro Corner / Newbie trying to get to grips with sprites

Author
Message
bassfiend
17
Years of Service
User Offline
Joined: 4th Apr 2007
Location:
Posted: 5th Apr 2007 00:38
Hi Guys,

This is really embarrassing but I'm having what must be a real dumb problem with even displaying my first sprite. I'm using the demo version of DarkBASIC Pro which unfortunately doesn't have all the help files so maybe the info I need is in there but without those I have no idea.

I'm working from the "Beginner's Guide to DarkBASIC Game Programming" book, chapter 11, "Creating and loading sprites"

I have a background image which is a 1280 x 1024 x 32bit bitmap and another file which is a graphic (of a bookworm, not that it makes much difference) on a black background (0,0,0) which is a 300 x 300 x 32bit bitmap.

Using the code out of the book I can't get the sprite to display on top of the background - I just get the background. If I 'rem' out the loading of the background then I just get a black screen.

Here's the code I'm using...



...which as far as I can tell is as per the book and I would assume should work. Any ideas what I'm doing wrong?

What I actually want to do in the end is define a bitmap with about nine rows of 48 point text on it (which I draw to the sprite on the fly when it is first created) then I can display sections of that as a sprite which will give me a smoothly scrollable list of options in a piece of code that I'm writing but at the moment I can't even get the sprite to display!

Thanks for any help ... it has to be me just being a complete div I know...

Cheers

Phil
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Apr 2007 01:20
As soon as you LOAD BITMAP, it becomes the current bitmap. So your first remedy is to SET CURRENT BITMAP 0 afterwards.
Alternatively you could just LOAD IMAGE for the bookworm, and reduce the code by an extra line.
bassfiend
17
Years of Service
User Offline
Joined: 4th Apr 2007
Location:
Posted: 5th Apr 2007 01:37
It looks like it's not quite as dumb as I thought...

Carried on seraching the Newcomers forum and found this topic:

http://forum.thegamecreators.com/?m=forum_view&t=75382&b=7

...which sounds as though the book I'm using applies to DarkBASIC rather than DarkBASIC pro and there are some differences in the way that sprites and images etc. are handled.

Unfortunately I'm trying to get the guts of this program working on the trial version so that I can be sure that it will do what I want before buying the full product but that means I don't have the full help files and examples which hopefully would have allowed me to have worked this out without making a div of myself up here.

Sorry guys...

Phil
bassfiend
17
Years of Service
User Offline
Joined: 4th Apr 2007
Location:
Posted: 5th Apr 2007 03:41
OK - This is where I'm at at the moment...



...what I don't understand is why is the upwards scrolling text effect so slow? That code takes about 1m 30secs to run on my machine here.

Am I going about this completely wrongly or is this just always going to be slow? What I'm aiming for is to be able to use this to have a nice smoothy scrollable list of maybe a couple of thousand movie titles that are read from my server, optionally sorted or filtered in some way and then scrollable through. Ideally aiming for a similar type of effect as you get on the main menu text of XP Media Centre...

I already hae the directory reading code working, I've had it scrolling a list of movie names a whole line at a time and it's even spawning off the player application properly with the selected title so now all I need to do is make it look pretty and add sorting / filtering functionality. (I have only been at this four evenings though so I think things are coming along nicely.)

Anyway - any ideas on how I can implement this with enough speed to be useable would be gratefully received...

Thanks

Phil
Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 5th Apr 2007 04:46
Put a 'sync' in your text loop and see if that helps - I had a similar problem sovled by this

for counter = 0 to 16
center text 640, (counter * 60), "Option " + STR$(counter)
sync
next counter
bassfiend
17
Years of Service
User Offline
Joined: 4th Apr 2007
Location:
Posted: 5th Apr 2007 09:50
Hmmm ... OK, I'll give that a try but I don't think that will make any difference at all because the text drawing bit is simply done once to the sprite itself and happens quite quickly...

...no - that didn't make any difference at all. But thanks for the suggestion.

What I'm trying to do with the code is draw a number of lines of text up to a sprite and then redraw a constantly changing section out of that sprite to simulate a number of smoothly scrolling (1 pixel at a time) lines of text...

Thanks

Phil
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Apr 2007 19:46
As you are learning the language, I have an alternative suggestion...

Why not download the trial version of DB Classic? That way, you shouldn't get the compatibility problems and won't be wasting the book.

At the level the book covers, DBC and DBP are essentially the same.

OK, DBP is faster and has more advanced features, but they won't be things covered in your book. The stuff that is will be the same for both versions of DB.

When you've finished the book, the knowledge you have learned will still apply when you move up to DB Pro.

TDK_Man

Login to post a reply

Server time is: 2024-11-25 20:42:38
Your offset time is: 2024-11-25 20:42:38