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 Discussion / My code isn´t obeying me again

Author
Message
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 11th Jul 2004 04:11 Edited at: 11th Jul 2004 04:11
To the point. Can anyone tell me how to stop a rogue image displaying itself before I want it to?
hillyselect.bmp displays itself before the the menu is setup and I don´t know why.
Here´s the code to the main loop and loading images.


Libera tu mente y te liberaras.
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 11th Jul 2004 05:33 Edited at: 11th Jul 2004 05:36
Mir, when you use the load bitmap command it makes that bitmap the current bitmap.

Use load image command rather than load bitmap, as it doesn't change the current bitmap. (at least in dbpro it doesn't, I can't remember if this is the case with DBC so I will have to check)
Also, if you do this you won't have to paste the image and then get the image.

Another option is to paste a flat black 3d plain before any load bitmap commands, but I tink that tis method is more trouble than it's worth.

Lastly, DBC usually handles bitmaps pretty well with the load bitmap command, but in dbpro it's a whole other story, especially when you want to retain pixel perfect copying. So if you ever plan on moving to DBpro, your best off using the method I first suggested. You could also delve into loading images from memblocks, but agin I haven't tried that in DBC, so I'm not sure if it is worth the effort.

~zenassem

Also, (untested you may be able to get around the issue if you take control of the sync yourself. I haven't tested this either, but I am will over the next few days, I am writing a tutorial in the "2d All the way board" in which I am exploring all the nuances of 2d with DBC & DBpro, There's a long list of things to try, and I will be including them as I can test each method. Let me know what results you get please. It will help me to pull all these little ins-and-outs together.


MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 11th Jul 2004 05:54
Thanks for your help Zen.
I normaly use the load image command but as I need to mirror the image so I can put it on the other side of the screen facing the other direction I had to load the bitmap first and then grab an image, mirror it and grab another. I suppose I could do this in paint and load them as 2 seperate bitmaps. I´l try that.
P.S You mentioned your on the pixelation site. Could you tell me your user name so I can look out for you.
Once again, gracias amigo.


Libera tu mente y te liberaras.
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 11th Jul 2004 06:22 Edited at: 11th Jul 2004 06:29
Same user name Zenassem,
I haven't posted much (19 posts) as I usually spend more time trying to learn from other's techniques. But I browse the boards there at usually everyday.
=====================================================================

I would make the image a sprite after loading the images:

sprite spritenum,xposition,yposition,imagenum

(just keep in mind that black (0,0,0) is treated as a transparent in DBC. I'm not sure if DBC allows you to set it to a different color via set image colorkey. (that may only be a dbpro command, or it may be allowed when using the Darkedit ide: I can't remember if it's possible) If you can't change it, then just repalce any of your black with a slightly off black rgb value (eg rgb 1,1,1 or 2,2,2). There are also commands to turn the backsave feature on and off. look at the set sprite command.


then you could use all the sprite commands: Mirror sprite, scale sprite, rotate sprite etc...

You can also use the paste sprite command -- if you do not intend to use the collsion commands. Paste sprite does not reatain the built-in collsion.

~zen


MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 11th Jul 2004 08:41
Right. Ive tried the idea of flipping the images before hand and it didn´t work. Though it does shrink the amount of code so I´ll keep it.

As far as I know there´s no way to change the transparent colour in DBC. One more reason why I can´t wait to get started on DBPro. Though I promissed to finish Dark Fight first so I´ve got to be patient.

Your idea looks like it could work. Though I´ll have to wait till tomorrow to try it out(actually later today) I´m too tired now.

Thanks for your help Zen, it´s much appreciated


Libera tu mente y te liberaras.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 11th Jul 2004 13:10 Edited at: 11th Jul 2004 13:11
You cannot change the transparent colour of sprites in DBC.

To have a "black" colour that is not transparent, you have to make the colour at least 10,10,10 because the threshold for the tranparency is anything below that.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 11th Jul 2004 15:11
or you could just turn the transparency off.

Quote: "There are also commands to turn the backsave feature on and off. look at the set sprite command.
"


here it is

SET SPRITE 1(sprite Number),1 (BackSave State),1 (Transparency state)

Quote: "The Set Sprite Command
The SET SPRITE command is very important because it lets you change both the background restoration and the transparency properties of the sprite. The default for these values is 1, which means that the background is saved and restored when the sprite is moved, and transparency is enabled so that black pixels are not displayed with the sprite. setting the background parameter to 0 will disable the background saving property, which means the sprite will smear across the screen , and it is up to you to restore the area under the sprite. The syntax for this command is SET SPRITE sprite number, BackSave state, Transparency State."


Basicly set the last parameter to 0 to turn transparency off.

this was quoted from "The Beginners Guide to DarkBASIC Programming", Which has really helped me in my learning of Darkbasic Classic.

Quote: "If you can't change it, then just repalce any of your black with a slightly off black rgb value (eg rgb 1,1,1 or 2,2,2). "


i've tried this and it doesn't seem to work for some reason

CURRENT PROJECT: Enemy At The Gates
Lost in Thought
21
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 11th Jul 2004 17:50
Does DBC not support manual syncing? I never see anyone using it.

MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 11th Jul 2004 19:50
It supports manual syncing. I´m using it for my game In case you don´t know. "Sync on" to turn it on then "sync" to update the screen.
It´s the same as DBPro(I hope).

I´ve sorted out the problem I was having. I forgot to delete a sprite from the previous menu so hillyselect.bmp was displayed.

Thanks for your help guys


Libera tu mente y te liberaras.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jul 2004 06:13
Hey Mir, nice picture. I just watched Enter the Dragon the other day.

"eureka" - Archimedes

Login to post a reply

Server time is: 2025-05-26 00:50:31
Your offset time is: 2025-05-26 00:50:31