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 / Question about doors...yes, doors.

Author
Message
r333
19
Years of Service
User Offline
Joined: 18th Jul 2005
Location:
Posted: 1st Aug 2005 02:30
When I make my levels for a FPS, i have absolutley no idea how to make a door. Can anyone help me with this? It's possible, i guess, to move the object, like this code
make object 1 cube (blah blah)
is spacekey() = 1 then move object 1...how do I make it go up?

Thanks!(for..whatever it is you did...)
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 1st Aug 2005 03:36 Edited at: 1st Aug 2005 03:38
r333,

Move Object, I would say, is mainly for characters, to make them to walk fowards or backwards. To make the door move up, just reposition it on the y axis. Create a seperate variable for the door, and add or subtract its value. Also, you don't want to be able to open the door from just anywhere, by pressing the spacekey. Note the example.

When the user pushes the spacekey, have it check the distance from the player to the door. If the player is within so far of the door, then the door should open. If you have many doors in the level, then when the spacekey is pressed, then you can make a quick loop that will find the distance between all the doors and the character. The one that is closest(there will usually not be two doors right next to eachother)out of all of them, will then open up

Example:



+NanoBrain+
r333
19
Years of Service
User Offline
Joined: 18th Jul 2005
Location:
Posted: 1st Aug 2005 04:13
Thanks a lot!

Thanks!(for..whatever it is you did...)
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 1st Aug 2005 04:48
r333,

I have attached to this post a working example of the code. Everything you need is in the zip file.


+NanoBrain+

Attachments

Login to view attachments
r333
19
Years of Service
User Offline
Joined: 18th Jul 2005
Location:
Posted: 1st Aug 2005 05:35
thanks again!

Thanks!(for..whatever it is you did...)
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 1st Aug 2005 20:06
'nother perfect code sample, NanoBrain :o

*bookmarks*

[Insert extremely witty comment here] :: Add me to MSN if you like, but don't expect any big favours [unless you like VB6]. ... IDK!!
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 1st Aug 2005 21:44
blanky,

Programming sure is fun, isn't it? Hehe.


+NanoBrain+
r333
19
Years of Service
User Offline
Joined: 18th Jul 2005
Location:
Posted: 1st Aug 2005 22:31
It sure is! Tanks again, everyone!

Thanks!(for..whatever it is you did...)
Non Official Company Owner
19
Years of Service
User Offline
Joined: 1st Jul 2005
Location: ???????????
Posted: 29th Aug 2005 23:08
r333 check your websites e-mail i e-mailed you.

??????????????????????????????????????????????????????????

Login to post a reply

Server time is: 2025-05-22 13:08:21
Your offset time is: 2025-05-22 13:08:21