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 / User Controlled Graphics !

Author
Message
MegaCodeOne
12
Years of Service
User Offline
Joined: 16th Jan 2014
Location:
Posted: 17th Feb 2014 19:02
; V = D / T

Which states velocity = displacement / time
The displacement is the distance travelled.
Time is the amount of time it took to travel that distance.
The faster you travel the distance meaning TOA Time of arrival.
The faster you were going. I.E. Velocity

Now, Think about this...
If we had a way to compute the distance we move the mouse around
and the time it took to move there we could use this formula too
describe how fast the player hits an object. I think it would have
to reset the distance once the player stops at a point but...
This would cause physics applied to mouse movement and make for more realistic simulations.

Can anyone help me out with this???
I should not be a major project just something someone might be able to whip up making gaming fun for us all.
Thanks
ScottieB


*********************************

Current_Time# = Timer()

Do

Cls

Text 0,0,\\\"Time# = \\\" + Str$(Time#)

Text 0,16,\\\"Velocity = \\\" + Str$(1000 / Time#)

Sync

Last_Time# = Current_Time#
Current_Time# = Timer()
Elapsed_Time# = (Current_Time# - Last_Time#) / 1000

Time# = Time# + 1 * Elapsed_Time#

Loop
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 17th Feb 2014 20:43
mouse move x() and mouse move y() will give you the distances, looks like you already have your elapsed time

MegaCodeOne
12
Years of Service
User Offline
Joined: 16th Jan 2014
Location:
Posted: 17th Feb 2014 23:20
I'm a little confused.
The displacement works right but only works once
before positions are equal.
Then now we have to incorporate timing for veloctiy.
I'm not sure what kinda number we have now or if we are
suppose to divide by 1000 for approx. 1 sec.
plus I want my final velocity to be from around 0 To say 10
can't seem to get it there can someone help please?

; V = D / T

Current_Time# = Timer()

SetMouseX GetScreenXPos() + 400
SetMouseY GetScreenYPos() + 300

X1# = GetScreenXPos() + MouseX()
Y1# = GetScreenYPos() + MouseY()

Do

Cls

Text 0,0,"Displacement = " + Str$(Dispacement#)
Text 0,16,"Velocity = " + Str$(Velocity#)

Sync

Last_Time# = Current_Time#
Current_Time# = Timer()
Elapsed_Time# = (Current_Time# - Last_Time#) / 1000

X2# = GetScreenXPos() + MouseX()
Y2# = GetScreenYPos() + MouseY()

X_Diff# = X2# - X1#
Y_Diff# = Y2# - Y1#

Displacement# = Sqrt((X_Diff# * X_Diff#) + (Y_Diff# * Y_Diff#))

If Displacement# > 0 Then Velocity# = Displacement# / (Current_Time# - Last_Time#) ; mili-seconds

X1# = X2#
Y1# = Y2#

Loop
Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 18th Feb 2014 00:29 Edited at: 18th Feb 2014 19:28
[SNIP] (wrong advice)

MegaCodeOne
12
Years of Service
User Offline
Joined: 16th Jan 2014
Location:
Posted: 18th Feb 2014 01:45
Uuuuuuuuuuuuuggggggggggggggghhhhhhhhhhhhhhhhhhhhh.

Can someone please code me up something that works.
I tried following tutorials online and I'm getting glitches
up the waaaaaaaaaaahhhhhhhhhhh toskyyyyyyyyy.

Please and thank you above but it doesn't help me much without
seeing something can tie up the loose ends.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Feb 2014 02:53
Can't you just use this to get the velocity vector of the mouse movement?



Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 18th Feb 2014 19:31 Edited at: 18th Feb 2014 20:20
Similar to what Phaelax is saying, you could use MouseMoveX() and MouseMoveY() to determine how 'fast' the mouse cursor was traveling at the time of impact:



This should eliminate the need for a timer because it refreshes the mouse 'speed' (distance traveled) information once per loop.

Login to post a reply

Server time is: 2026-07-08 05:36:53
Your offset time is: 2026-07-08 05:36:53