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 / newxvalue & newzvalue object positioning problem

Author
Message
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 23rd Sep 2007 20:32 Edited at: 23rd Sep 2007 20:43
OK well I'm trying to develop my entry for the DBC challenge but using full media. I'm adding in a gosub clause to let the player drop mines, but instead of dropping the mine behind the boat as I'd intended, the code places the mines along a diagonal accross the arena which the center of my boat is on, so it can come out with the mine in the boat, in front of it, behind it or on either side. This could cause problems when I come to implement the code, as the collision detection could be set off by the mine you are currently placing. here's the subroutine to place the mine:




all the arrays have been declared already, and object 1 is the player 1 boat. objects 10-20 are the mines which have already been loaded for the player to place.

any help would be greatly appreciated. Thanks muchly for your time.

http://jamesmason01.googlepages.com/index.htm
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Sep 2007 21:45
Well, I see you using two different Angley# variables:

A float : AngleY#=object angle y(1)
and a float array : AngleY#(0)-180 inside the NewXValue, NewZValue

Did you mean to type AngleY# as AngleY#(0) ?

Enjoy your day.
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 23rd Sep 2007 23:14 Edited at: 23rd Sep 2007 23:19
uhh maybe yeah, but I have AngleY#(0) declared in another part of the code anyway so it shouldn't make a difference, I just put them all there as well so that I could narrow down the amount of things that could go wrong. But I'll change it anyway, see if owt happens.

Thanks


EDIT:


still no luck

and it's not a very good picture (print screen doesn't look so good in the reload areas, and converting to .gif messed up the picture even more, but you should be able to see how they're all sort of in a line, even though i placed them at all different angles from the same spot)




http://jamesmason01.googlepages.com/index.htm
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th Sep 2007 04:35
@demons breath

Well, here is an example of how to place the mines at different angles relative to the direction your boat is facing. In this example, there is a cone that represents the boat. The direction the cone is pointing is the front. The cone will slowly rotate to show that it's y angle is changing (the direction it's pointing). If you press the arrow keys, the corresponding key will place a mine to that side of the cone. The premise is, whatever value the yangle of the boat is, get an offset from that in the direction you want to place the mine, and use newxvalue and newzvalue and that offset angle to place the mine. By changeing the offset angle, you could place a mine 360 degrees around the boat at whatever distance you choose.



Enjoy your day.
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 24th Sep 2007 10:28 Edited at: 24th Sep 2007 20:05
hmm yeah I was basically trying to do what you did for the downkey button there... I don't know what's wrong with my code though... I'll try your example later, but I gotta get to college now... got 10 minutes to do a 25 minute walk to get there on time...

EDIT: I just copied some code from earlier on in my code and replaced the array values with what I wanted... for some reason it works now...


& Latch I didn't want it to place at different areas around the boat. I wanted it to place behind the boat - it just wasn't working. probably some tiny mistake i didn't pick up on. but thanks for the help anyway, and sorry for not being very clear in my first post.

http://jamesmason01.googlepages.com/index.htm

Login to post a reply

Server time is: 2025-05-31 20:30:27
Your offset time is: 2025-05-31 20:30:27