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 / Newxvalue and Newyvalue command clarification?

Author
Message
roswell
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location: United States
Posted: 13th Mar 2006 07:37
I'm going through Chris K's Pong tutorial right now and I'm at the point now of getting the ball moving. From the tutorial, the newxvalue and newzvalues control the ball's movements, but I don't think I'm understanding how the new_value commands work because my ball is moving off at an unexpected angle. I thought that by giving the newxvalue and newyvalue a current x/y value and the same angle that I would get a new x/y value along that angle, but my ball seems to ignore the angle value, or is calculating a new one somehow. In the example code below, I have a starting angle value of 90 which I provide for both the newxvalue and newyvalue commands, but my ball seems to be shooting off at a 135 degree angle. Can anyone help explain to me why this is?



'Just one game,' they said, and started to play. That was yesterday.

Dual Athlon 2.0/1GB RAM/GeForce Ti4200-128/Win2000 Pro
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 13th Mar 2006 10:04
newyvalue does some weird maths different than others I believe.

I know it sounds weird, but just use newzvalue for second line instead of newyvalue and it all works fine, keep parameters you pass it the same though.

Boo!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 13th Mar 2006 10:48
Newyvalue makes a tan wave, which isn't actually a wave at all, heheh, don't think that if you're moving on the y-axis you should use newyvalue. As spooky said, use Newzvalue and it should be fine.

roswell
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location: United States
Posted: 13th Mar 2006 14:40 Edited at: 13th Mar 2006 14:40
That is very strange behavior, but it doesn't look like it does work with the newzvalue either. Try setting the "ballang#" variable to something other than 90. I set mine to 110, and it the ball continued to travel at what appeared to be a 90 degree angle in the X plane, but it actually came out a little ways in the Z plane to pass in front of the bat instead of through it. I don't think using newzvalue will work when I start throwing it strange angles. Any other ideas?

'Just one game,' they said, and started to play. That was yesterday.

Dual Athlon 2.0/1GB RAM/GeForce Ti4200-128/Win2000 Pro
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Mar 2006 11:06
It works perfectly.

You should not alter zposball# at all. Just use newzvalue but use y values in the parameters for it.



Boo!
roswell
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location: United States
Posted: 14th Mar 2006 15:04 Edited at: 14th Mar 2006 15:04
Ah, I see. I missed your point about keeping the parameters the same. That's just bizarre. Ric from the DBPro forum also provided this solution:



Thanks for your help, spooky!

'Just one game,' they said, and started to play. That was yesterday.

Dual Athlon 2.0/1GB RAM/GeForce Ti4200-128/WinXP Pro

Login to post a reply

Server time is: 2024-11-27 23:24:11
Your offset time is: 2024-11-27 23:24:11