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 / A couple questions

Author
Message
Resident Evil 4 fanboy
19
Years of Service
User Offline
Joined: 2nd Feb 2005
Location: Where evil doers are!Oh wait, my room!
Posted: 20th Jul 2005 04:39
1. I want to know how do you program a gun to shoot bullets?
2. Lets say the player is standing in front of a car, how do you program him to go in the car?
thanks

Don't mess with spiderman!
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 20th Jul 2005 08:16
I'm not trying to put you down but both may be too complex for you to program right now.

There are many ways to program a gun to shoot bullets but they way you do it will depend on if you are using DBC or DBP.
In theory all you need to do is figure out if the player has enough bullets, once fired, find the nearest object within range of the bullet then thats who you have hit. You can do this in DBP using intersect object. Possibly looking into an invisble extended limb if you are using DBC. Even simplier but slower, create a bullet object, a plain will do. Once fired, use newxvalue and newzvalue to move the bullet forward once it collides with an object, then thats who you have hit.

For the second question. First of all, create two cubes, one being the player, one being the car. Set up controls to move the player, if the player is within range of the 2nd cube (the car) and the spacebar key is pressed, hide the player object and set controls to the car. If spacekey is pressed again, position the player next to the car (can be as simple as x = object position x(2)-50) and show the object. Finally set controls back to the player.
Once you have that working, then I would work on the more complex programming of making a person enter the car.


Have you ever heard of Pseudo code? Its not real code, more of what you want happen. For example:



This may help you think through your steps.

Good luck to you!

J

Hello!
Resident Evil 4 fanboy
19
Years of Service
User Offline
Joined: 2nd Feb 2005
Location: Where evil doers are!Oh wait, my room!
Posted: 20th Jul 2005 09:33
thanks

Don't mess with spiderman!
Resident Evil 4 fanboy
19
Years of Service
User Offline
Joined: 2nd Feb 2005
Location: Where evil doers are!Oh wait, my room!
Posted: 20th Jul 2005 12:16
wait! I still have a question about the car! would the rules still apply if it is open expose veichles like cavertables, etc

Don't mess with spiderman!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Jul 2005 22:06
About the car:
calculate the distance between player and car, if close enough, go into car.



Immunity and Annihalation makes Immunihalation...
Resident Evil 4 fanboy
19
Years of Service
User Offline
Joined: 2nd Feb 2005
Location: Where evil doers are!Oh wait, my room!
Posted: 21st Jul 2005 00:48
alright, but still. for example, in halo 2 when you get in a vehicle like a warhog you able to see yourself driving the car.

Don't mess with spiderman!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 21st Jul 2005 02:50 Edited at: 21st Jul 2005 02:51
Spidy you're really not ready for this type of thing but if you must:

- Create your basic car and your player object
- Create a simple animation of getting in and out of the car
- Add a limb to the car, a small sphere will do, and offset it so that it's positioned at the car door you want the user to get into.
- Check if the user is colliding with this sphere, possibly by using intersect object (COLD ), basic object collision commands, or a dll. like NGC.
- If the user IS colliding with the sphere, play an animation of the user getting into the car, pause the user's frame when it's in the sitting position, and position the user correctly inside the car - every loop.
- You'll then need some way of keeping the user in the seat and rotating them as the car rotates, I recommend using GLUE OBJECT TO LIMB.
- Now you have entering a car, to create the exiting process simply check if the user presses the spacekey again, if so and they're inside the car, play the getting out animation and position them outside the car.

I recommend using a variable to tell if the user is inside the car or not, could be something as simple as INSIDE#=1 for inside, and INSIDE#=0 for outside.

Thats a very basic way of accomplishing what you want, and I mean very. If you don't understand one of the commands listed above or dont have a clue about doing anything of what I stated above, you're not ready and should continue learning and experimenting until you understand.

Goodluck.
- RUCCUS


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
Resident Evil 4 fanboy
19
Years of Service
User Offline
Joined: 2nd Feb 2005
Location: Where evil doers are!Oh wait, my room!
Posted: 21st Jul 2005 06:16
thank you

Don't mess with spiderman!

Login to post a reply

Server time is: 2024-11-27 22:40:41
Your offset time is: 2024-11-27 22:40:41