How do I fix this procedural generation?

  • Hello this is my first time posting in the forums and I am pretty newb at coding though I've been messing with construct 2 on and off for 3 or so years, but I cant understand this problem.

    Everything in the code seems to work until I turn on the bookmarked line which moves the created rooms to somewhere off the layout even though the array values are there and inside of the layout and displayed properly in the debug.

    If I disable the line to set the roomsize to the array value the rooms appear in the layout for the most part but sometimes one is right outside even though the coordinates are inside the layout.

  • I don't understand why do you need to pick array instance in such a weird way in event #4. Just move "roomsize Set Size" action to event #3.

    Also, you can add roomsize and DangeonRooms objects into a container. This way the roomsize sprite will be created automatically when DangeonRooms instance is created.

    I don't know why the sprite is shown off-screen, check its origin image point, as I understand it should be at (0,0) position. Are you scaling or scrolling your layout or layers? Also, if you have the default instance of roomsize sprite on this layout, you should destroy it in "on start of the layout" event, or move to some unused layout.

    If this doesn't help, please share your capx.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't understand why do you need to pick array instance in such a weird way in event #4. Just move "roomsize Set Size" action to event #3.

    Also, you can add roomsize and DangeonRooms objects into a container. This way the roomsize sprite will be created automatically when DangeonRooms instance is created.

    I don't know why the sprite is shown off-screen, check its origin image point, as I understand it should be at (0,0) position. Are you scaling or scrolling your layout or layers? Also, if you have the default instance of roomsize sprite on this layout, you should destroy it in "on start of the layout" event, or move to some unused layout.

    If this doesn't help, please share your capx.

    Thanks for the reply, the image point was off causing problems. As for the weird way of picking the array i was kinda just experimenting with ways to pick the array cuz that was the only thing i could think of at the time that might be causing problems. I'll be getting rid of that since its not needed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)