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 Professional Discussion / Camera code not working?

Author
Message
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 15:22
Hi. I seem to be having a problem with the camera. it's not positioning the camera on the correct object. The 2nd thing is if you hit the z key, it should reposition the camera to the object of choice.

Can someone please help me?



Thanks!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 19th Jul 2010 15:52
You never set the value of camnum, so it equals 0. You have nothing that tells it what to follow if it is 0.

So many games to code.......so little time.
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 15:54 Edited at: 19th Jul 2010 15:56
ok, thanks, now its following.

the problem now is if you hit the z key, nothing happens.

if you hit the z key, the camera should follow the specified object



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 19th Jul 2010 16:01
You could make your do-loop like this....should work:



So many games to code.......so little time.
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 16:04 Edited at: 19th Jul 2010 16:06
EDIT:

It doesn't work for more than 2 objects

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 19th Jul 2010 16:08 Edited at: 19th Jul 2010 16:14
You're welcome.

Quote: "It doesn't work for more than 2 objects"


You only created two objects. It would be better to create a global variable for the total number of objects that you want to follow and plug that in at this

line, so that it reads



(this assumes that you make TotalObj equal to the total number of objects that you want to follow. They will have to be created consecutively since you are getting the next free object from a function.

So many games to code.......so little time.
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 16:09
It doesn't work for more than 2 objects

i also need it so that when it reaches the last object, it goes back to the 2nd to last object, then the 1st, etc..

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 16:14
Sorry for the double post but:

PROBLEM SOLVED!

Here it is for all the people that wish to use this code with their games!



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 19th Jul 2010 16:18
Quote: "PROBLEM SOLVED!"


It does work, however, you would need to create any additional objects (that you want to follow) all at the same time before you create/load any other objects in the game.

So many games to code.......so little time.
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 16:24
i made it so only if the object exists, will it activate the camera code.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 16:27
small fix:



i made it so if the objnum is > maxnum then reset to 1.

correct?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/

Login to post a reply

Server time is: 2026-07-25 16:20:06
Your offset time is: 2026-07-25 16:20:06