Tennis Game, hitting the ball

Hey guys im making a tennis game, i have moddeled everything now i just need the scripts to work.
I need a script so when you press the left mouse click, it hits the ball when the ball is in a radius of about a half meter from you.
If anyone knows a tutorial or a script for making a tennis game it would be awesome, cause i can’t find anyone.
And if you have time, it would be awesome if how longer you hold the left mouse click, the ball with go longer.
Thx guys :-)!

Do you have code we can edit?

just an idea.
In Onmousedown count a strength variable up until cap
In OnmouseUp stop the counting up, instantiate a plane at the player/player-rotation-based position and pass it the strength variable.
The plane then runs a script which adds an impulse (back to the other side) based on the passed strength to the ball if it hits.
you could also, when instantiating the plane, modify the rotation of the plane based on the players and the balls position to let the player be able to chose an angle to hit back.
after the hit is done delete the plane.

No i don’t have any scripts. I havent got that long in scripting. I can only script small things which i learned on youtube :-)!
So thats why im asking you guys, and will also learn from that script :slight_smile:

Needs answers :(!!

You always make the code first… (Just my way of doing it)
I will help if you help me on my project! (Check your posts, Its the one where you asked to be part of a game’s development)

You mean the post where i asked for work :)? Sure what do you need?
Im experimenting with building stuff, and designing levels, so im not that focused on scripting so i always make scene first :slight_smile:

The reply to that thread should be approved soon. Basically i need a 3d artist. I hope you know how to make guns, caves, and turrets :slight_smile:

uhmm… I don’t know how to make models, if that is what you are asking about. But i can make enviroment :-)!
Check a video of a WIP game i made :slight_smile: Its a 3d sidescroller game in a cave :slight_smile:
I made some more since the video, if you want to see more.

EDIT: I forgot to mention that, i started using 3ds max, yesterday so im in pogress of learning it, but i don’t know that much yet :slight_smile:

As long as you can contribute

Thread Closed.