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

Author
Message
pagio
22
Years of Service
User Offline
Joined: 8th Jan 2003
Location: - Please Select -
Posted: 6th Mar 2003 14:53
what exacly that command does?
why i should use it
Dont forget the retro games
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 6th Mar 2003 15:30
You can use it instead of syn and cos math functions in order to calculate new position if you have angle and distance of movement

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Mar 2003 19:23
NEWXVALUE(X,ANGLE,SIZE) is simply (SIN(ANGLE)*SIZE)+X

I think these commands were added purely to simplify the maths.

Here's an example
sync on
sync rate 0

` outer circle uses SIN/COS
for angle=0 to 360
x=(SIN(angle)*200)+320
y=(COS(angle)*200)+240
dot x,y
next angle

` inner circle uses NEWXVALUE/NEWZVALUE (see note below)
for angle=0 to 360
x=NEWXVALUE(320,angle,190)
y=NEWZVALUE(240,angle,190)
dot x,y
next angle

sync
wait key

NEWYVALUE produces exactly the same numbers as NEWXVALUE so I'm not sure why it's provided.
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 7th Mar 2003 00:34
Here's a comparison of the commands:



Once I was but the learner,
now, I am the Master.

Login to post a reply

Server time is: 2025-08-08 20:40:03
Your offset time is: 2025-08-08 20:40:03