Search:

Type: Posts; User: Bingo90

Search: Search took 0.07 seconds.

  1. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Hmm that could work... I'll try that.
  2. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Light spreading works fine when removing a wall. But it'll do absolutely nothing when placing a wall, because I haven't implemented the code yet. I tried, but I have no idea how to do this :/
  3. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    There's a colon, updated the post and quoted it to make it more understandable
  4. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Okay, this is how it works (some kind of pseudocode)

    void removeWall(int x, int y)
    {
    setWall(x,y,null);
    updateLight(x,y);
    }

    void updateLight(int x, int y)
    {
  5. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    It only updates when placing or removing a wall. There are 2 arrays, a byte array (the light values) and a wall array(the walls). I told you how the light spreads.
  6. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    I know, that's why I made a thread here. I don't know how I can achieve this.
  7. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    When placing a wall, it should remove the light from the no longer existing light source.
  8. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    When a wall is removed, updateLight is called at this position. "if (getWall(x, y) == null)" is checking if there's a wall (of course after the removal there's no wall) and if not, the light level is...
  9. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Actually the light is a 2D byte array, only the wall is a 2D Wall array.

    Here's the image uploaded to this site:

    2827
  10. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Here you go :)
  11. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Here's how the light updates:

    2825

    A update's B, C, D and E - B updates G, F, H, and want's to update A - but A's more lit than B, so B doesn't update A. A space only updates a space next to...
  12. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    The darker space is not taking the light from the lighter space, it's the opposite.

    Here's an example:

    2824

    A's light is 6 and updates B. B gets light 5. B update's C which gets light 4. C...
  13. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Right now it's not in a ring form. And the light is not additive. The light of the space is the light of the most lit space next to it (up, down, left, right not diagonally) -1. Min light is 0. And...
  14. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    In the first and second pictures the lamp has a light power of 13 (max), in the third picture 6.
  15. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    How far the light reaches depends on the power of the lamp, but yes you're right.
  16. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    If there's no wall on that space, the lamp's light will shine through that hole and the space is lit with the lamp's light power. A space also light's all spaces next to it with the light power -1.
  17. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    That's the problem. Like I said, when removing a wall tile, it calls the updateLight method, which calls it again for the spaces next to it. It should also call it when placing a wall, but it should...
  18. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Updated the code to make the light power dynamic

    Well, here's an example if 2 walls are removed:

    2821

    When replacing one it should go back to this:

    2822
  19. Replies
    38
    Views
    4,833

    Re: Java light source simulation

    Removed unneccesary code and commented the rest.
  20. Replies
    38
    Views
    4,833

    Java light source simulation

    I'm trying to make a light source simulation and it almost works. It's a 2D simulation, there are wall tiles in front of a lamp. When removing a wall tile the light shines through the hole. When...
Results 1 to 20 of 20