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 / 2d game layers

Author
Message
helpme
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location:
Posted: 29th Jan 2006 02:48
I am making a 2D game that will run multiple games simultaniously in different windows on the screen. Behind the windows, there is a backdrop. On top of the backdrop image it will print the high scores. Above the text will be the windows (boxes) that the game will run in. The windows can move around, be resized, or change color. More boxes may open (if another game is started) and they can also be closed. On top of each box will be a copy of the text based game.

Anyway, my question is how can I make different layers in my game? When a game closes, rather than clearing and recopying everything on the screen, how can I just clear the layer that the game is in and the layer that its window is in? How can I make sure that when it prints a new high score, it's printing behind the windows? How can I paste a new backdrop without covering everything else?
Thanks.
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Jan 2006 11:29
Use plains. Texture the plains with images. Put the plains in front of each other using different Z settings.

helpme
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location:
Posted: 29th Jan 2006 18:37
I tried plains but I'm confused: How can you move and resize plains? How can you put text and 2d shapes on top of a plain? How can you cls the text/shapes that are on top of a plain?
kmad
19
Years of Service
User Offline
Joined: 24th Jan 2006
Location:
Posted: 31st Jan 2006 11:58
There is an example of using 3d sprites in the binary moon tutorials on the developer section of the website. It's probably a good idea to start there and examine the functions in "sprite.dba" (that you download in the sourcepack for the tutorial).

I personally use the following code to create the sprite (basically the same as the code from the binary moon tutorial library).


Then I use the following function to position the sprite (this is actually for using a 3d plain as a mouse cursor and getting it to follow the mouse pointer around the screen).



You move and resize plains in exactly the same way as you move and rescale objects normally. Using the MOVE OBJECT, SCALE OBJECT etc.. commands. If you don't want the objects to show then you use the HIDE OBJECT command. If you want to change the image on a plain then just texture it with a different image. The only slight difficulty comes with trying to align the images with ordinary 2d screen coordinates but the above function does that ok (someone probably has a much better way of doing it than that though).

An example of using 3d plains as sprites can be found in the Swarm game example. Look at that, look at the binary moon tutorials and search the forum. You'll find all of the information you need on the subject.
kmad
19
Years of Service
User Offline
Joined: 24th Jan 2006
Location:
Posted: 31st Jan 2006 15:27
There is an example of using 3d sprites in the binary moon tutorials on the developer section of the website. It\'s probably a good idea to start there and examine the functions in \"sprite.dba\" (that you download in the sourcepack for the tutorial).

I personally use the following code to create the sprite (basically the same as the code from the binary moon tutorial library).


Then I use the following function to position the sprite (this is actually for using a 3d plain as a mouse cursor and getting it to follow the mouse pointer around the screen).



You move and resize plains in exactly the same way as you move and rescale objects normally. Using the MOVE OBJECT, SCALE OBJECT etc.. commands. If you don\'t want the objects to show then you use the HIDE OBJECT command. If you want to change the image on a plain then just texture it with a different image. The only slight difficulty comes with trying to align the images with ordinary 2d screen coordinates but the above function does that ok (someone probably has a much better way of doing it than that though).

An example of using 3d plains as sprites can be found in the Swarm game example. Look at that, look at the binary moon tutorials and search the forum. You\'ll find all of the information you need on the subject.
kmad
19
Years of Service
User Offline
Joined: 24th Jan 2006
Location:
Posted: 1st Feb 2006 08:35
Apologies for double posting there, for some reason the edit post button keeps coming up with 'Unknown System Error' messages and in a moment of confusion I double posted...sigh...

The edit I wanted to make was just to say that the line in the second function, IF SCREEN WIDTH() = 1024 THEN m_x# = 3.0 should be IF SCREEN WIDTH() = 1024 THEN m_x# = 3.2.
helpme
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location:
Posted: 1st Feb 2006 21:19
Thank you.

Login to post a reply

Server time is: 2025-05-23 10:48:47
Your offset time is: 2025-05-23 10:48:47