The image of my object is not seen in Wollok Game

1

I am setting up a very simple example of Wollok Game, based on the documentation :

This is my game.wpgm

import pepita.*
import wollok.game.*

program PepitaGame {

//  CONFIG  
    game.title("Pepita")
    game.height(10)
    game.width(10)

//  VISUALES
    game.addVisual(pepita)

//  START
    game.start()
}

And here pepita.wlk

object pepita inherits PersonajeAnimado {
    var posicion = game.at(3,3)
    method imagen() = "pepita.png"

}

I run the program, I see the board correctly, but my object is not there.

My file structure is:

proyecto
|_src
     |__game.wpgm
     |__pepita.wlk
|_assets
       |__pepita.png

If I change the name of the file to another (which does not exist), the object with the Wollok logo appears.

I think he recognizes the file, because he does not show me the Wollok logo, but I do not understand why he does not show it.

    
asked by Victoria Ruiz 20.08.2018 в 22:01
source

1 answer

1

Finally I solved it. I discovered that I was actually showing the image of my object. Since it is very large and with a transparent background, only the part of the transparent background was visible.

This is how Wollok works with the images of the Wollok Game:

  • Each space on the board measures 50x50 px.
  • The image chosen in method imagen() is displayed with the actual size, unchanged.
  • If the image is too large, it will exceed the board space to which it was assigned.

In my particular case, the image was a PNG transparent background, 1000x1000, and my board measured 500x500 (10 squares of 50px on each axis), so it happened that the visible part was not shown on the real board .

    
answered by 20.08.2018 в 22:29