## "Islands" not being generated after certain x/y value

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
BlueThumbDevelopment
Prole
Posts: 7
Joined: Mon Jan 21, 2019 5:36 pm
Contact:

### "Islands" not being generated after certain x/y value

So I've been messing around with island generation and i do have on that works. However if I try and generate an island after certain x and y values it says it generated but does not draw on screen? I do not know if I have accidentally made a limiting factor for x/y values perhaps?

Feel free to request code or have a look at the code (generation is in noise.lua)

I've tried to fix this for god knows how long and I'm in need of help
Attachments
islands.zip

ReFreezed
Citizen
Posts: 75
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

### Re: "Islands" not being generated after certain x/y value

Are you maybe drawing outside the 5000x5000 canvas? I don't see any other limits in the code.
Games: Momento Temporis: Light from the Deep, Momento Temporis: Arena, Energize!
"If each mistake being made is a new one, then progress is being made."

pgimeno
Party member
Posts: 1943
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

### Re: "Islands" not being generated after certain x/y value

The # operator isn't guaranteed to work unless the arrays start in 1. I think LuaJIT is more forgiving about not starting exactly with 1, but not as much as 1000 times more forgiving.

The problem seems to be in the iteration limit for the drawing loop. Changing it to this worked for me:

Code: Select all

                for x = island.x, island.x + size do
for y = island.y, island.y + size do


BlueThumbDevelopment
Prole
Posts: 7
Joined: Mon Jan 21, 2019 5:36 pm
Contact:

### Re: "Islands" not being generated after certain x/y value

pgimeno wrote:
Sat Feb 02, 2019 8:09 pm
The # operator isn't guaranteed to work unless the arrays start in 1. I think LuaJIT is more forgiving about not starting exactly with 1, but not as much as 1000 times more forgiving.

The problem seems to be in the iteration limit for the drawing loop. Changing it to this worked for me:

Code: Select all

                for x = island.x, island.x + size do
for y = island.y, island.y + size do

Okay pgimeno, I'll give it a try in the morning! Thanks for giving me a hand

### Who is online

Users browsing this forum: DPS2004 and 12 guests