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.

Newcomers DBPro Corner / making one-way doors

Author
Message
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 1st Aug 2011 01:33
This seemed simple enough in theory. In my example I wanted a one way door leading west, I figured any location east, ne, se of the door would see it as a door, but from any other direction it would show a solid wall.



However when this is running, it shows a wall. Changing the greater than sign to less than makes nothing show up.

"So it goes."
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 1st Aug 2011 02:10
oops, made a mistake in the code I showed, it should be


sorry about that

"So it goes."
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Aug 2011 16:21
You might need to check the values by having them print on the screen. There isn't anything wrong that I can see here, maybe the values you are expecting aren't what you are getting?

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Aug 2011 17:18
If the door is just a simple plane, you could use its normal along with the player to determine which side of it you're on.

Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 2nd Aug 2011 22:20
I tried printing the data to the screen as baxslash suggested, and that helped me get the numbers right, so that now it shows a door when it should, and a wall when on the other side. But I am still having a problem being able to walk completely through the door, I get stuck on the location.

"So it goes."
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 3rd Aug 2011 04:07
I was thinking about this one yesterday and came up with a simple solution.

If you're using a collision system or just the built in one then either way it shouldn't matter.

Using a box area as a collision box around the door. When the player enters the collision box then activate a flag to show the player is within the box. When the player has exited the collision box then just check the coords of the player. If the player is on the other side of the door then set a flag to not allow the player to pass. And if not then reset the main flag to say the player is back but the door is passable.

Erm, I hope that was understandable.

Warning! May contain Nuts!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Aug 2011 10:36
I guess we'll need to see more code to help with this one. There isn't enough info here.

What collision system are you using?

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Aug 2011 14:55
If you're using sparky's collision system, there's an awesome trick you can do. Place a 1 sided plain object blocking the door with the visible side facing the way you are able to walk. Sparky's doesn't detect collision when you're coming from the side that isn't visible, so you'll be able to walk through the door. If you try to go back the other way though, the visible side of the plain will stop you. You can then hide the plain so you don't see it, collision will still work.

TheComet

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th Aug 2011 01:09
@TheComet - I was thinking that originally. Nice one. Can you still hide collidable objects using DBPro's normal collision commands? (I'd still prefer to use Sparky's though...

Warning! May contain Nuts!
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 4th Aug 2011 21:08
here is the code that works as far as showing the right graphic at the right time, but on being on the space I cannot move forward, its like there is an invisible wall in the way.



I don't have sparky's
@WLGfx your idea sounds great but I don't know how to implement it, can you please be more specific?

"So it goes."
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 5th Aug 2011 03:52
Hopefully TheComet's idea should also work with the DBPro's collision system as the back-face of a plane object doesn't affect a collision, it doesn't register. The plane object can be hidden but still collidable. You can go through the door and through the back-face of the plane object but when you try and go back through the front-face of the plane will cause a collision, thus stopping you from going back through the door. Using that you won't need a flag either, you just simply check for the collision each round against the plane.

Warning! May contain Nuts!
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 5th Aug 2011 23:06
I was using cubes for the doors, but figured out how to orient planes (plains) to use them instead, which seems a lot better for all the regular doors, but I am still having the collision problem with the one-way doors, only I am being stopped in the center of the 'square' where the door shows up, without actually being allowed to pass through it, so I never can get to the other side.

"So it goes."
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 6th Aug 2011 02:14
I finally got it to work as expected by using the flag method on the door location. Here is the finished segment of code if anyone is interested in seeing how it was done.



Thank you to everyone for your helpful suggestions!

"So it goes."
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 7th Aug 2011 01:19
Yeah, I wasn't sure completely about passing through a plane more than halfway from the back face would actually work without a flag setting. I was going to test that theory out later or tomorrow when I had the time but I'm for now assuming that a collision would be registered once the halfway point was met. Nice one Jaded Gamer

Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-11-24 03:03:07
Your offset time is: 2024-11-24 03:03:07