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 / can't put text on top of the screen in a 2d environment

Author
Message
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 19th Nov 2014 21:50
Hi,

I am making a simple 2d game. Like apples falling from the tree and you have to catch them.

Now I want to print the score on the top of the screen with :



The promblem is that the text is behind the background screen. Is there a way of putting z depth in the sprites? I don't want to use a plain (3d) object.

( The background is a screen filling sprite of a landscape and it moves when the player moves.)

It has to be 100% 2d.

Toedeledoki
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Nov 2014 18:14
From what I remember, you can't put 2d images (like text sent to the screen) in front of a sprite. A sprite is always in front.

You can, however manage the priority of the sprites (which sprites are in front and which sprites are behind). I believe the sprite number decides which sprite is front of which sprite.

If you create a background bitmap and send your text command there, capture that as an image and create a sprite, you should be able to have that in front of the other stuff.

Enjoy your day.
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 20th Nov 2014 23:36
Wow writing to a bitmap and grabbing int and using it as a sprite worked.

Thank you very much.

The sprite oder is good to know, I am using depth with the trees.

I am almost done. When it is done (I hope this weekend), I can post it in program announcement (incoluding code)?


Have to put some sound with it, a start screen and an ending screen.

Greetings.

Toedeledoki
Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 23rd Nov 2014 12:20 Edited at: 23rd Nov 2014 12:26
Hi HomerS,

I know a trick to overwrite a sprite; Use the command "draw any sync on".
I never really tested this command, so I advise you to make tests before use.




DirectX 9.0c (February 2010)/ DBClassic v1.20
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 24th Nov 2014 22:05
Oke, Here is the image of the game I made.

Its called apples. Catch 10 apples and you win.

Press space to start...

Mij coding is nog 100 % oke, but it is fun.

screen size = 640 x 480

Let me know if you like it.

Greetings.

Toedeledoki

Attachments

Login to view attachments
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 24th Nov 2014 22:07
and here the game...

Toedeledoki

Attachments

Login to view attachments
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 9th Dec 2014 10:20
A Quaint little game you've, got there. It's spelled *apples*, though.
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 9th Dec 2014 19:20
hahaha!, you are right, I am dutch, mixed the dutch appels with the english apples. lol

Toedeledoki
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Feb 2015 01:47
Neat! I like the parallax effect!

Enjoy your day.
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 14th Feb 2015 15:17
As a DBPro/DarkGDK programmer, I can’t say I’m too familiar with DarkBasic Classic. I really don’t understand why everyone insists on using sprites for there background. Paste Image can handle any requirement needed for a background image without this kind of problem.
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 14th Feb 2015 21:25
tnx latch, just like a little of depth.

Wickedx, I am an amateur with less time to program, so I did it as a sprite, it works, but the whole programming can be written better.

LOL

Now I am playing arround with AGK2 by steam. Have to keep up with time. apps appss appsssssss......

Toedeledoki
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 14th Feb 2015 22:38
I understand. Nice game btw.
HomerS
17
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 15th Feb 2015 10:16
thanks!

Toedeledoki

Login to post a reply

Server time is: 2024-11-21 12:25:41
Your offset time is: 2024-11-21 12:25:41