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 / help with a newb to dbpro....trouble with drawing sprites and back drops...

Author
Message
Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 11th Feb 2007 08:37
I'm new to dark basic, I bought the beginers guide to dark basic only to find that either my editor doesn't work properly or much of the code in the book is wrong. I'm having trouble with sprites and trying to get a moving star background basis for my game. Here is a basic subroutine I wrote to help get 3 sprites pulled in, but they never display.... If I use the debugger and mess with sync and cls I can see them but then they get hidden again somewhow. Do I need some kind of sprite priority or am I just goin about this the wrong way? I've spent hours reading the forums, the book and trying to get the code to run properly. I've written several smaller programs, mostly playing with numbers, with no problems. Any help or links to good help (for dbPro, as texture backdrop is an invalid command)would be greatly appreciated. Thank you for any help.
Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 11th Feb 2007 16:48
oOo here's the code....

Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 11th Feb 2007 18:29
eh I look smart keep forgetting to add details....
I always get a blue screen with no sprites. After a few more hours of playing with it I can now get the sprites to appear but I can't animate them or anything.....again I read over about 20 more forums and sitll no soloution.....any help is greatly appreciated....

here's all my code thus far....(as of right now...it changes quit a bit)...



I may just be confussed about all this....I have read that many examples in the beginners guide are wrong....which is causing mayham with me learning to use this language....again thank you so much for any help : )
Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 11th Feb 2007 22:14
O and another note.....I can't update my darkbasic Pro....I dl'ed the 1.6 patch and then my dbpro doesn't work....I've tried several times and reinstalled just as many. I always get a can't find dll file error. Any idea's or input is appreciated. I always get a blue screen....with enough playing around (with the same code I can get it to work), perhaps I have a problem with my dbpro?

I"m runnin this..
P4 @ 3.2Ghz
2 Gb ram
128Mb Nvidia Gforce 6600GT gfx
Windows XP

thanks anyone who can help : )
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Feb 2007 22:37 Edited at: 11th Feb 2007 22:41
Its easier to use "load image" rather than "load bitmap". "Load image" is both "load bitmap" and "get image" without the need to set the current bitmap back to zero. You only want to use "load bitmap" if you want to grab multiple images or modify the image before the user sees it.

When you use sprites (especially ones that cover the whole screen) you make it so you can't see any text drawn to the screen because sprites are on top of everything. You can use "paste image" instead to put a copy of the image on the screen like a stamp.

It's probably best to avoid using images to scroll stars and just make the stars on the fly using an array.

This works in both Classic and Pro:


TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th Feb 2007 23:54
A bit of additional information to add to what Grog said:

With DB, when you see the word 'Bitmap' in a command you should read 'screen'.

DB has a number of screens (max 32). The only one you actually see is the default one - screen 0 (zero) - the rest are hidden. You switch between screens using the Set Current Bitmap command.

When you use the Load Bitmap command, the Windows bitmap you load is placed on the screen with the number you specify. If this is not 0 then the bitmap is not seen.

What is important to know is that Load Bitmap has a 'built-in' Set Current Bitmap command. So if you use Load Bitmap "filename.bmp",2 then it also does a Set Current Bitmap 2.

This means all screen operations like Text and Get Image all work on screen 2. When you've finished, you are responsible for doing a Set Current Bitmap 0 to set screen 0 back as the one you want to work on.

When you've finished with a screen, Delete Bitmap X will delete it.

Also screens can be re-used. If you load a bitmap into screen 1, cut an image from it and are then finished with it, you can use the same screen number to load the next image - rather than loading the next image into another screen.

You only need to leave a screen there if you need to grab more images from it later on - otherwise use the Delete Bitmap command.

TDK_Man

Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 12th Feb 2007 01:43
I'm under the impression that manually drawing the stars all the time isn't a good way of doing this (from reading other posts) and I'm able to write and run a manual star creation program now. I was tryin to do something a bit more advanced, that would look better and run more effeciantly. I can't try a lot of the scource code posted becuase you actually have to have the images their using.Do you guys have any other recomendations? and any idea's about me not being able to update dbpro? do I have a problem that the source code from the beginners guide isn't working? and I know I"m askin a lot of info....but I am better off skipping right to 3D? I've come to understand in dppro that its actually easier to write in, but I wanted to learn on something a bit easier like 2D first. Thanks again for any input guys, I only hope I can return the favor sometime somehow. : )
Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 14th Feb 2007 01:14
ok I took your advice and used load image....I rewrote it a bit but now I get a crazy amount of flicker like the screen is goin blue then to the image I paste then back to blue......ideas? I shortend the program and hopefully made it a bit more readable....any suggestions on how to do things like this? I haven't even implemented moving stars or anything yet.....

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Feb 2007 01:44 Edited at: 14th Feb 2007 01:52
Quote: "I'm under the impression that manually drawing the stars all the time isn't a good way of doing this (from reading other posts)"


For side scrollers probably not... I should of realized thats what it was for but it didn't dawn on me till I reread your messages.

Quote: "and I'm able to write and run a manual star creation program now."


Its good to know the code I posted wasn't a total waste of time.

Quote: "I was tryin to do something a bit more advanced, that would look better and run more effeciantly. I can't try a lot of the scource code posted becuase you actually have to have the images their using."


Those of us that help others usually attach any media thats required to the message. Most of the time I use media-less code... the code itself creates any media thats required in the program.

Quote: "and any idea's about me not being able to update dbpro? do I have a problem that the source code from the beginners guide isn't working? and I know I"m askin a lot of info....but I am better off skipping right to 3D? I've come to understand in dppro that its actually easier to write in, but I wanted to learn on something a bit easier like 2D first."


I don't know why you couldn't update Pro... you might want to try to uninstall and reinstall it again. I haven't seen the Beginners Guide to Darkbasic so I don't know. I personally like 2D more than 3D even though I'm totally addicted to World of Warcraft. 2D is better to start with especially if you've never programmed before.

What you're specifically wanting can be done with two sections at a time. Each section has a specific image number that changes when the first section goes off the screen. The actual sections x coordinates are reset back to their starting locations and the image number associated with both sections is increased.

This works in both Classic and Pro:


Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 14th Feb 2007 03:06
thank you : )
that method works much better, I also came across more help in the 2d section, they have a great beginners guide in the works and it helped with my blue flicker problem.

another question (yeah I know I'm a real pain)
I can now get it all drawn right....but my sprite appears offscreen unless I use really small cooridinates

resolution 1024x768
screenx = 1024
screeny = 768
sprite, custom made, 50x50 pixels
tried code like sprite 1,screenx/2,screeny-75,1

now that code works when I set the text cursor or draw a cirlce but not when I draw the sprite? if I rnd the x and y values, I see the sprite and I can just use really low cooridantes...but....why won't that work as well? I'm kinda flabergasted....I want to use that to set my intial position of the ship before I write a subroutine to move it, it seems like the sprite is just being drawn off screen, kinda weird imo.

but with all the help you guys have given me I"m 'very' greatfull, thank you so much for taking time to anser me




that solves my flicker, thank goodness. I did try offsetting the sprite, but to no avail. I know the program isn't set up well, this is a practice program by witch I plan on designing my actual game off of, so don't mind the mostly pointless funcion calls, I'm just getting you to the absolute basics so I can write effectively. Thanks again guys.[img]null[/img][img]null[/img]
Lunar Fusion
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 14th Feb 2007 14:37
strange, I set the sprite to my mouse coordinates and it shows up fine....even if I monitor those coordinates...



and now that just confusses me to a whole new level....why does it appear ok with my mouse and the same coordinates as my mouse but not the same number I type or use math to get? I didn't change the draw order (though I did try several) or anything else. once I get this basic sprite controll down the rest of the game should be fairly easy (hopefully). anywho thanks again whoever reads and ty for any and all help : )
I hope other newbs are reading this and getting help : )

Login to post a reply

Server time is: 2024-09-25 17:33:02
Your offset time is: 2024-09-25 17:33:02