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 / I need help with my game

Author
Message
stupid kid
20
Years of Service
User Offline
Joined: 16th Sep 2004
Location: at my house
Posted: 26th Oct 2004 05:56
I need help with my game. The boat doesn't rotate, i used to be able to make the boat turn with the turn object left command but now i'm trying to make a camera to follow the boat and so i replace that code with some code from the tutorial and now the boat won't turn. All the graphics and sound and stuff is on the darkbasic cd. I'm using DBC.

the first version


The second version


Can u also tell me how to make it so that the boat can't go off the water and aslo can u tell me how to make the sky look better and not just the same picture tiled on the background. Thanks
Errie
21
Years of Service
User Offline
Joined: 6th Nov 2002
Location: NW England
Posted: 26th Oct 2004 07:52
I've rewritten a lot of the code - click the 'Source' button to get it.

Your problems with rotation were caused by using variable 'y' without setting it as the angle of the object - I've corrected this.

I've improved the sky by making a sphere and texturing that with the sky texture. This is positioned above the camera every time it moves. I've also improved the look of the water because I was bored - if you don't like it, it shouldn't be too hard to figure out how to remove.

The boat is kept on the water by checking that the position of the object isn't outside certain bounds and if it is then it is corrected for.

Hope this helps.

We rode on the winds of the rising storm, we ran to the sounds of the thunder.
We danced among the ligtning bolts, and tore the world asunder.
stupid kid
20
Years of Service
User Offline
Joined: 16th Sep 2004
Location: at my house
Posted: 26th Oct 2004 09:34
The sky and the water looked alot better, the boat also stayed on the water. but, The boat still doesn't go like i want it to. When the player of the game presses the left or right arrow keys i want the boat to rotate, not the camera. I want the player to be able to control the boat and the camera follows it. If you don't understand what i mean see the first version of my code at the top.
Errie
21
Years of Service
User Offline
Joined: 6th Nov 2002
Location: NW England
Posted: 26th Oct 2004 20:34 Edited at: 26th Oct 2004 20:41
ah, I see. I was just going off what the code in your second version was attempting to do. Try this version.

[EDIT]Use THIS version:

not the version that you get from the 'Source' button. I realised that the code for moving the sky was no longer necessary but I can't edit the code I've posted.

We rode on the winds of the rising storm, we ran to the sounds of the thunder.
We danced among the ligtning bolts, and tore the world asunder.
stupid kid
20
Years of Service
User Offline
Joined: 16th Sep 2004
Location: at my house
Posted: 27th Oct 2004 04:56
It still doesn't work like i want it too. I want the boat to go in the direction the front of the boat is facing. I want the boat to rotate or turn when you press the left and right arrow keys and I want the camera to follow the boat.
Errie
21
Years of Service
User Offline
Joined: 6th Nov 2002
Location: NW England
Posted: 27th Oct 2004 08:01 Edited at: 27th Oct 2004 08:02
The boat does turn when you press left/right
I don't get what you mean by the camera following the boat - in my first change the camera stuck right behind the boat which you said was wrong and you said to look at your first piece of code. I did this and noticed that the camera stayed in exactly the same place and so replicated this in my code.
The only other thing I can think you might mean is you want the camera to point at the boat - if this is the case then try this:



If that doesn't do what you want then tell me what it is doing that you don't like and what it isn't doing and try to be more descriptive.

We rode on the winds of the rising storm, we ran to the sounds of the thunder.
We danced among the ligtning bolts, and tore the world asunder.
computer
19
Years of Service
User Offline
Joined: 5th Oct 2004
Location:
Posted: 27th Oct 2004 13:15 Edited at: 27th Oct 2004 13:54
I'm struggling.

I'm not sure how to control the camera X and Y positions.
Would we use sin and cos
[href]
http://www.hyper-ad.com/tutoring/math/trig/Trigonometric%20Functions%20of%20Common%20Angles.html[/href]

I can't grasp the idea yet. I can't see how you would control the X and Z values following a circlular line!

bleep bleep
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 27th Oct 2004 14:46
You use sin and cos when you want the camera to move in circles. Are you familiar with trigonometry? Sin and cos will take an angle and convert it into x and y offsets. This way, you can keep a variable for the angle, then use sin and cos to position the camera in the standard x,y,z coordinate system.

Xander Moser - Bolt Software - Firewall

Login to post a reply

Server time is: 2024-09-23 03:32:15
Your offset time is: 2024-09-23 03:32:15