Hey people,
I have been messing around a little bit with the code from brackeen's game tutorial (http://www.brackeen.com/javagamebook/#download) and now have a start for a nice little top down tile-based game/engine. I have the basics done, and now want to implement some sort of shooting/attack for the player. I have made little games in the past where a bullet image would be added and it's x value would be increased/decreased. But I would really like to be able to have the bullet follow the direction of a mouse click. I have also done this in the past, but am having a problem now because when i try to use the Point class, it only accepts integers. So, basically my question is...What would be the best way to go about overwriting the Point class to accept floats as parameters?
I can include some code if it is necessary, but it seems pretty straightforward enough. Any suggestions are welcome. Thanks ahead of time people I really appreciate it =)
Java Game- Shooting bullet with mouse
Page 1 of 12 Replies - 668 Views - Last Post: 02 July 2012 - 07:35 AM
Replies To: Java Game- Shooting bullet with mouse
#2
Re: Java Game- Shooting bullet with mouse
Posted 02 July 2012 - 02:21 AM
No need to make your own, you can use the Point2D.Float class
#3
Re: Java Game- Shooting bullet with mouse
Posted 02 July 2012 - 07:35 AM
Or Point2D.Double for better precision. Avoid floats unless there is a compelling reason to use them.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|