Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Swinging Mouse
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wadeshaqdunk




PostPosted: Thu Jun 02, 2005 3:28 pm   Post subject: Swinging Mouse

How can I make the user swing the mouse and depending on how they swing it, the basketball that appears where the mouse does will be shot at a basket in different ways (and speeds)?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Thu Jun 02, 2005 4:40 pm   Post subject: (No subject)

This is an interesting question. Here's a hint as to how I would go about it:
Each time through your loop, you do a Mouse.Where. Store those values (x, and y, not button) into variables. Next, compare the values with the values for this time's Mouse.Where. (Basically we determining the change in the position of the mouse.) So we know delta d (delta displacement). We can measure time, and thus get velocity. But we don't really need to measure time, since this is shooting a basketball, not physics. Razz
Apply the delta d to the basketball. This should all work, because we are assuming that the mouse has total control over the ball. Even if the ball were infinately heavy and moving infinately fast, the mouse would be able to stop/reverse it instantly.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: