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.

Author
Message
Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 31st Jul 2013 15:16
I got a problem when the beast running and it look like hitting each trees lol

I do know about SetSpriteDepth ( ) but what I am trying to workout is

How I get Beast running behide the tree to make him look running through the forest....

for example

B=Beast
T=TREE

B
TTT TTT TT

Beast should be in the background and tree should be in foreground

so if come to coding and it would like

SetSpriteDepth (Beast,10 ) Rem Mean he is far away
SetSpriteDepth (Tree, 5 ) Rem The tree is near front of the Beast

Is that Correct or I got it wrong way round?
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 31st Jul 2013 15:23 Edited at: 31st Jul 2013 15:33
The lower the zdepth, the closer it is to the camera. So, if you have an enemy or player sprite and a forest, you have to set it to lower than the tree sprites to show the enemy in front. But really I think you'd end up wanting layers, it'll look cool, and let you have some neat parallax effects.

I would suggest setting a virtual playfield of say, 100 deep, add in some buffer to allow score displays etc to take precedence. So, say your playfield goes from 10 to 110, with 10 being quite close to the camera, maybe 20 is the zdepth that you want the player. If you use the zlayer as a factor in scaling the sprites and their scroll speed, well sprites with a higher zdepth value should be smaller and scroll slower. Any trees that are set <20 will be in front of the player, anything >20 is behind the player. I think it's better to consider the playfield as a virtual 3D layered stage for your game, like one of those puppet stages with the cutout characters and stuff - don't see it as just a number you have to get right, see it as a way to control sprite ordering and introduce parallax backdrops.

I actually did something similar to this for a menu in a game myself and Cliff M are making - drew a few layers of trees, and a few layers of fog - got the fog layers scrolling gently, and the trees scrolling in a parallax playfield type thing. It's very effective, layering the fog especially makes it look very organic.

I would suggest having your own Z depth value, and work out the scrolling speed, scale, as well as the zdepth from that, then you can adjust it until your happy with the speeds and scaling etc quite easily.

I got a fever, and the only prescription, is more memes.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st Jul 2013 15:29
You could take a look at my isometric depth tutorial. It's not quite what your after, but may give you some ideas to automatically set your sprites depths according to screen height. Just check the dvaders tutorials thread.

Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 18th Aug 2013 01:59
Thanks guys

I have done Z-Ordering

Now I am working timing for different object going passing by to get it right

Login to post a reply

Server time is: 2024-11-24 17:53:51
Your offset time is: 2024-11-24 17:53:51