Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:54:28+00:00 2026-06-18T06:54:28+00:00

I’ve got a GameScreen class that has a touchpad within it. I have a

  • 0

I’ve got a GameScreen class that has a touchpad within it. I have a method (setTouchpadY()) within the GameScreen class that gets the touchpad’s getKnobPercentY.

public float setTouchpadY() {
  return touchpad.getKnobPercentY();

}

In my WorldRenderer class, the render() method, I’m trying to rotate a sprite with the touchpad. gs is the GameScreen class

public void render() {
  //render stuff
  moveCamera(leon.getPosition().x, CAMERA_HEIGHT / 2);
  spriteBatch.setProjectionMatrix(cam.combined);
  spriteBatch.begin();
  drawVillage();
  drawTile();
  drawLeon();
  spriteBatch.end();

            if (leon.isAiming()) {
     leonAimArmSpriteR.rotate(gs.setTouchpadY());         //This line causing crash
  }

}

I’ve put the touchpad and buttons into the Gamescreen class because it’s implementing Screen and Input Processor. Tried to put them into WorldRenderer with no luck so far.Here is my logcat/console, this is from trying to run the desktop version, if I need to post the android I will

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NullPointerException
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: java.lang.NullPointerException
at com.me.RE4.view.WorldRenderer.render(WorldRenderer.java:142)
at com.me.RE4.screens.GameScreen.render(GameScreen.java:151)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:191)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)

EDIT
So I’ve found that I had not instantiated GameScreen, when I did that it was saying that WorldController is the null. So I instantiated WorldController in WorldRenderer, but then it’s saying that TouchpadY() method within GameScreen is null, set the break point and that’s giving me all sorts of variables as null.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:54:30+00:00Added an answer on June 18, 2026 at 6:54 am

    Alright, I was trying to do the rotation within WorldRenderer initially, within the render method so that holding the touchpad steady at a certain point would keep rotation going at that degree. I would have had to instantiate / reference a lot of items within WR for that to work, so I ended up instatiating gamescreen in WR and then referenced my sprite that I wanted to rotate in GS and then the touchpad values worked within the render method of the GS. Mucho sloppy

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have an array which has BIG numbers and small numbers in it. I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.