Jump to content
  • Advertisement
Sign in to follow this  
LAURENT*

Object won't render no matter what I do.

This topic is 597 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello:

 

One of my classes won't render. The class is called "ObjectPlayer". Other classes do render their graphics. I tried making the order of creating new objects different. I tried stripping the ObjectPlayer class to just call the draw method. I tried stripping the other classes of their methods to only call their draw method, I tried changing the constructor, I tried copying the code from a working classes to the ObjectPlayer class. I tried checking the debugger to see if there was a undefined variable. I tried placing a break point on the draw method to see if it gets call(it does). I'm out of ideas and will power.

 

https://www.dropbox.com/home?preview=MySecondGame+Ver2.zip

Inside this link is my game for android studios. Could one of the more experienced users take a look at my code and the ObjectPlayer class. I literally have no idea why this class doesn't render the player.

Edited by LAURENT*

Share this post


Link to post
Share on other sites
Advertisement

You'll have to share that file (the button "Share" on the right, in the row with zip file).

Right now you've posted link within your own account. It's inaccessible from outside.

Share this post


Link to post
Share on other sites

Note that quite ironically your code calling draw on the player from the gamepanel class is commented out, so that won't work for sure  :P

 

But to get you started:

 

1. Is the position of the player even valid? Could it be it's being drawn offscreen? 

2. Is there possible overlap? Your player is drawn as one of the first objects. Perhaps something is constantly being drawn over it?

3. Was there a point at which it did draw the player?

4. Have you tried using a different texture? Or just a single texture for the player, rather than an entire animation spritesheet

5. Do other objects use any animations? This is to make sure your animation class is functioning as you'd expect

Share this post


Link to post
Share on other sites

Note that quite ironically your code calling draw on the player from the gamepanel class is commented out, so that won't work for sure  :P

 

But to get you started:

 

1. Is the position of the player even valid? Could it be it's being drawn offscreen? 

2. Is there possible overlap? Your player is drawn as one of the first objects. Perhaps something is constantly being drawn over it?

3. Was there a point at which it did draw the player?

4. Have you tried using a different texture? Or just a single texture for the player, rather than an entire animation spritesheet

5. Do other objects use any animations? This is to make sure your animation class is functioning as you'd expect

 

1) In the debugger the y and x cords seems to be on screen

2) I removed the background at some point.(No where to hid now!) Unfortunately It still did not render.

3) I might have commented it out when testing. The players draw function is suppose to activate.

4) I tried using the players texture on the fireball object and it worked correctly. The art resources doesn't seem to be the problem

5) I tried only using one frame on the player and adding animation to the fireball object. The player still wouldn't render but the fire ball was animated. I reversed this a while ago.

 

This build of the game was from a week ago that I prepared for this thread. I was going to make this thread but I decided to try a little harder before asking for help and now here we are. Since I only commented stuff out I decided to post that build but I think I'll correct this now. In this link is the build with nothing commented out. The game will run as normal.

 

There are some un used methods lurking. I haven't purged them yet due to being stuck with this rendering issues. Excuse the mess.

https://www.dropbox.com/s/j5n5kbmkx7c6jqn/MySecondGame%20Ver2%20FIXED.zip?dl=0

Share this post


Link to post
Share on other sites

Has anyone detected the problem? I'm really curious to see others have discovered.

 

I found something interesting. 

 

Animation animation = new Animation();

.When I checked this in the debugger I noticed animation.PlayedOnced was true for the fireball and false for the player. I looked over my code and everywhere I could and did not find anything that would make them different. Both the classes should have this.

Share this post


Link to post
Share on other sites

So I got it to work. What I did was destroy the whole project and started from the beginning. I never figured out what caused the problem but at least my stuff works now. Did anyone else find the problem?

Share this post


Link to post
Share on other sites

Usually you'll want to try and create a minimal test case; both to help you find the problem yourself, and to make it quicker and easier for us to help.

 

I don't usually have time to download a whole project and then try and dig through it to find out where the actual code is, and then try to find out where the actual program is.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!