Skip to content

Making inventory grid "any" shaped #1

@PR3CL1K

Description

@PR3CL1K

I'm trying to build game that is similar to building ships in StarDrive 2

stardrive2

it's mean that grid is not square but triangle or any wierd shape like ship.

Anyway, i manage to implement this into your code (i'm not programer but just learning hobbist), so it would be great if you implement it to your code so more people can acess it

"My" method is creating grid with pixel image like this https://www.youtube.com/watch?v=B_Xp9pt8nRY. After that, i just do some corection to your code so it doesn't show eror that you try acess tiles that are dont exist

  1. InvenGritScript

In CreateSlots function, inside iner for cycle i add this

if (color == map.GetPixel (x, y))
{...
..}

so it generate tile just when color (like black pixel) match your pixel map

  1. InvenGridManager

In SlotCheck function, inside iner for cycle i add this

if (slotGrid [checkStartPos.x + x, checkStartPos.y + y] != null)
{.....
...}
else return 2;

In both ColorChangeLoop, inde iner for cycle i add this

if (slotGrid[startPos.x + x, startPos.y + y] != null )
{...
...}

And this is result of future ship
result

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions