Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
shooting basketball

paperbag
Registered User
Quote
2023-08-19 22:10:00

So I want to be able to shoot a basketball in the game.

So however long you hold down the left mouse button

The harder it shoots.

The skill curve is always lining the ball up.

And not have to look up to shoot the ball is that possible?

Willing to pay if somebody can do it.


paperbag
Registered User
Quote
2023-08-22 19:47:21

I edited the request, is it possible for someone to do that?


Dieter
Guest
Quote
2023-08-23 13:07:00

If this is for windows, you could use the built in physics.

Then you would accelerate the ball in a certain direction, independent from the camera. Do that on mousebutton-release.
On mousebutton press you store the timer. On release you calculate the time difference between pressing and releasing, and the longer it is, the more you accelerate the ball.

This tells you the milliseconds that have past since the last booting:

currenttime=new Date();
millisecs = currenttime.getTime();

It's a steadily increasing number, useful for time measurements.

In order to communicate between the two behavior scripts, you can use a ccb variable.

So, add a behavior to the ball: when a key is pressed (mouse, when pressed), in "special, execute javascript": it gets the millisecs timer and stores it:

gw_currenttime=new Date();
gw_millisecs = gw_currenttime.getTime();
ccbSetCopperCubeVariable("millisecs", gw_millisecs);

Add a 2nd behavior, on key press, specifically on mousebutton RELEASE, that does this:


gw_currenttime=new Date();
gw_millisecs = gw_currenttime.getTime();
pressed=ccbGetCopperCubeVariable("millisecs");
elapsed=gw_millisecs-pressed;
force=elapsed/1000;
if(force<0.1){force=0.1;}
if(force>1){force=1;}
// here you would accelerate the ball, using "force" as a factor.

Using the built in physics is a chapter on it's own. But I guess there's plenty of help and docs.


serge
Registered User
Quote
2023-10-06 16:40:45

paperbag wrote:
So I want to be able to shoot a basketball in the game.

So however long you hold down the left mouse button

The harder it shoots.

The skill curve is always lining the ball up.

And not have to look up to shoot the ball is that possible?

Willing to pay if somebody can do it.


Check out CopperBasketball

https://youtu.be/vaRltuRXeac?si=...


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact