Error using Jplay framework for games!

Asked

Viewed 268 times

0

Hello, I am trying to program in java with the Jplay framework, and I am finding an error that was non-existent on another pc that I had. The error step is found in this video lesson: https://www.youtube.com/watch?v=ntDvADUoMs8

game class code:

package jogo;

import jplay.GameImage;
import jplay.URL;
import jplay.Window;

public class Main {
  public static void main(String[] args) {
     Window janela = new Window(800,600);
     GameImage plano = new GameImage(URL.sprite("menu.png"));

     while(true){
         plano.draw();
         janela.update();    
     }
 } }

The error is the background image that does not render. I am using version 1.8 of java. I hope friends can help me solve this little problem of "gray screen".

1 answer

0

Cara went through the same situation and the solution is very simple...

Instead of vs do:

GameImage plano = new GameImage(URL.sprite("menu.png")); 

vs pass the direct path of the image, which in your case would be "src/resources/sprites/menu.png".. Staying that way:

GameImage plano = new GameImage("src/recursos/sprites/menu.png");

Vs need to do this also for the Tiles files and the scn scenario files, ie do not use the URL class and use the direct file path that vs want to use to not give error.

Load scenario file:

cena.loadFromFile("src/recursos/cenarios/Cenario1.scn")

To load the files of Tiles just put the complete path of it in the file of cenario.

Dude, if you do it right, it won’t be a mistake. Hope it all works out! D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.