- 0
Logic problem in lingdx game development java
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
JetBrains releases IntelliJ IDEA 2025.1.1, bringing multiple bug fixes and improvements
By David Uzondu,
- jetbrains
- intellij idea
- (and 6 more)
- 0 replies
- 0 views
-
- 0 replies
- 0 views
-
- 14 replies
- 0 views
-
Activision spent $700 million in development costs alone for Call of Duty Black Ops Cold War
By LoneWolfSL,
- microsoft
- activision blizzard
- (and 7 more)
- 5 replies
- 0 views
-
High Performance with Java ($33.99 Value) free eBook download
By News Staff,
- ebook offer
- sponsored
- (and 2 more)
- 0 replies
- 4 views
-
Question
sk21
I have been stuck on this problem for days now. This is a simple ball game. The problem is that I want to make the ball jump. The ball is inside a much bigger circle. This is the screenshot https://postimg.org/image/ru0os2jer/ or
.
I will try to explain my code as much as possible. Firstly whenever the user inputs data, the setXPosition() is called, now this method just sets the X Position without considering the angle etc. Then setYPosition() is called through the update() which automatically sets the Y position based on the X position. now, this is a little bad way of doing this, because X position doesnt change relative to the angle, which it should. it makes the ball's Y position faster at sides and slower in the middle. Now, when it jumps, the jump() method is called. and the gravity() method is called whenever update() is called. the *630/11 is a little wrong, i have fixed it since then and it is being used to convert radians into degrees, now i am using Math.toRadians. the GameScreen.mainCircle is the bigger circle in the screenshot (the white one) .Then InnerInnerCircleRadius is just the radius at which the ball is drawn(basically, it is GameScreen.mainCircle-ball.radius)., I have used a different radius (GameScreen.INNER_CIRCLE_RADIUS), but that is just the GameScreen.mainCircle again. I hope the Game Screen code is not necessary so I have not posted it. if yout think it is, please tell me and I will post it. There are a few idiotic variables. please dont pay attention to them, I created them in desperation. I am still a very beginner programmer. and though, I have made games in libgdx before, nothing this complicated. I have tried everything, and couldn't solve it. according to me, the ball's X position should change when it jumps but it doesnt. The Y position changes perfectly. In setting the X position, the code should take in account either the angle or the InnerInnerCircleRadius. any help is appreciated.
Link to comment
https://www.neowin.net/forum/topic/1307084-logic-problem-in-lingdx-game-development-java/Share on other sites
1 answer to this question
Recommended Posts