Seeing Through Tree Cover

For questions about using Classic.

Post » Tue Oct 12, 2010 9:19 am

I'm playing around with hand-painted environments for an RPG, and have got a lot of trees ready to map with. The trouble is, if you're standing behind a tree, you obviously can't see your character, or any enemies he may be in combat with. If you're in woodland or forest... it's going to be impossible to play.

So would it be possible to make an invisible circle around your character that erases parts of the trees it comes into contact with? Giving the effect of seeing into the section of woodland your character is standing in, without just erasing all the trees completely?

Hard to explain so here's a visual example I've mocked-up:

Default tree: [url:m041fmyg]http://i216.photobucket.com/albums/cc212/darkstorne/canopyeraseexperiment.jpg[/url:m041fmyg]

Tree with erasing effect: [url:m041fmyg]http://i216.photobucket.com/albums/cc212/darkstorne/canopyeraseexperiment2.jpg[/url:m041fmyg]
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Tue Oct 12, 2010 9:35 am

You may be able to get your desired effect with the canvas object, but I'm not sure about that.

What I do in this situation, is make the particular object obscuring my character go slightly transparent while he is behind it.
B
15
S
2
G
3
Posts: 50
Reputation: 1,863

Post » Tue Oct 12, 2010 10:14 am

[quote="-Silver-":2prc5i2s]So would it be possible to make an invisible circle around your character that erases parts of the trees it comes into contact with? Giving the effect of seeing into the section of woodland your character is standing in, without just erasing all the trees completely?

Hard to explain so here's a visual example I've mocked-up:

Default tree: http://i216.photobucket.com/albums/cc21 ... riment.jpg

Tree with erasing effect: http://i216.photobucket.com/albums/cc21 ... iment2.jpg[/quote:2prc5i2s]

There is an actual ERASE effect, which you could try to use to achieve something likes this. Just slap it on a circular sprite and activate it if the according conditions are met. Well, and I believe you should activate the FORCE OWN TEXTURE attribute of that layer. Don't shoot me if that's wrong though... :P

Other than that, there's also the OUTLINE effect. Which was pretty common to use that way in older games. It's maybe not what you would want.

That's a pretty tree btw. :)
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Oct 12, 2010 3:32 pm

You could also have a fullscreen canvas, paste the trees that are in front, then paste a circle sprite with the erase effect to it.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Wed Oct 13, 2010 4:28 am

maybe if the tree is overlaping the player,set tree opacity to 20. :wink:
B
3
S
2
G
2
Posts: 136
Reputation: 1,347

Post » Wed Oct 13, 2010 9:02 pm

In most games, don't they change the entire tree's opacity? Try it out like that (it shouldn't be hard) and see what you think. If it looks good, you won't have to mess with anything very complicated.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Thu Oct 14, 2010 2:50 pm

Thanks for all the advice! I'll definitely use transparency instead of a complete invisibility, so I'll see if I can get that working with the canvas. If not, I will just have to turn the whole tree transparent instead, which still does the job.

Thanks again.
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Thu Oct 14, 2010 3:30 pm

[quote="-Silver-":1suxd3fy]Thanks for all the advice! I'll definitely use transparency instead of a complete invisibility, so I'll see if I can get that working with the canvas. If not, I will just have to turn the whole tree transparent instead, which still does the job.

Thanks again.[/quote:1suxd3fy]

Just to clarify what I was getting at in my earlier post... here's a simple example:
[url:1suxd3fy]http://dl.dropbox.com/u/2306601/treesee.cap[/url:1suxd3fy]
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Thu Oct 14, 2010 5:17 pm

[quote="PixelRebirth":1npvw5up][quote="-Silver-":1npvw5up]Thanks for all the advice! I'll definitely use transparency instead of a complete invisibility, so I'll see if I can get that working with the canvas. If not, I will just have to turn the whole tree transparent instead, which still does the job.

Thanks again.[/quote:1npvw5up]

Just to clarify what I was getting at in my earlier post... here's a simple example:
[url:1npvw5up]http://dl.dropbox.com/u/2306601/treesee.cap[/url:1npvw5up][/quote:1npvw5up]
Wow, thanks for taking the time to put that together! For some reason I'm struggling to get this to work when I edit the tree's layer mask though... I want the tree base to be solid so that the player cannot walk through the trunk, but is still able to walk behind it. So I've made the tree a solid object and erased everything from the layer mask except for the base. The collision detection works, but the player doesn't disappear when he walks behind it and the circle doesn't show up.

If I remove the 'solid' attribute from the tree then the player disappears behind the parts of the tree with the layer mask, appears correctly in front on the tree, but still shows up on a higher layer when he should be behind it whenever he's not in contact with part of the layer mask. And, of course, he can walk straight through the trunk...

I guess I'm doing something very wrong here? :P Should layer masks for trees not be deleted at all to achieve this affect? And if so, how can I make the trunk a solid object? Using an invisible block at the base could help I imagine, but would lose the exact pixel collision.

Hope that's not too confusing :S
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Fri Oct 15, 2010 10:35 am

[quote="-Silver-":2tm1ozjn]Wow, thanks for taking the time to put that together! For some reason I'm struggling to get this to work when I edit the tree's layer mask though... I want the tree base to be solid so that the player cannot walk through the trunk, but is still able to walk behind it. So I've made the tree a solid object and erased everything from the layer mask except for the base. The collision detection works, but the player doesn't disappear when he walks behind it and the circle doesn't show up.[/quote:2tm1ozjn]

Well, that's not really surprising since the events in my example use an overlap condition in order to work. And when you edit the collision mark, it doesn't overlap anymore properly.

[quote="-Silver-":2tm1ozjn]
If I remove the 'solid' attribute from the tree then the player disappears behind the parts of the tree with the layer mask, appears correctly in front on the tree, but still shows up on a higher layer when he should be behind it whenever he's not in contact with part of the layer mask. And, of course, he can walk straight through the trunk...

I guess I'm doing something very wrong here? :P Should layer masks for trees not be deleted at all to achieve this affect? And if so, how can I make the trunk a solid object? Using an invisible block at the base could help I imagine, but would lose the exact pixel collision.

Hope that's not too confusing :S
[/quote:2tm1ozjn]

A little confusing right there, hehe. I'd say you should put another sprite in a container with the tree. That object would be invisible and be solid. You shape it accordingly and set it to the tree's position with an event. That should take care of that.

But another problem I would see with this method is Z odering. Like smaller stuff, that would be behind the tree (like a flower for example), but maybe in front of the player at his feet and visible too, when the player is covered by the tree. I guess that may have sounded a little confusing now as well. Anyway, at this point I'm not quite sure how I would achieve this myself, while still using the basic method I showed. Maybe I'll give it another try these days.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests