love.math.random not working on iOS in Love V 11.1

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.
Post Reply
kippllo
Prole
Posts: 6
Joined: Sun Apr 15, 2018 2:23 am

love.math.random not working on iOS in Love V 11.1

Post by kippllo » Tue Apr 17, 2018 6:52 pm

Hello all, I am working on a game with a background built from pixels with a random value for the grass color.
I use this code to get the pixel color values: pixels.g = love.math.random(125, 200)

On the PC build I get pic 1.

But whenever I put it on iOS I get pic 2.

I suspect the is some problem with the love.math.random not being cross-platform in the new version of love??
But I'm not sure at all.
Thank you for any help in advance!
Attachments
Screen Shot 2018-04-17 at 1.43.57 PM.png
Screen Shot 2018-04-17 at 1.43.57 PM.png (32.45 KiB) Viewed 356 times
Image-1.jpg
Image-1.jpg (22.86 KiB) Viewed 356 times

User avatar
Nixola
Inner party member
Posts: 1928
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: love.math.random not working on iOS in Love V 11.1

Post by Nixola » Tue Apr 17, 2018 7:17 pm

You have LÖVE 0.10 on your pc, but 11 on your iOS device. The color range changed from 0-255 to 0-1, meaning you need to divide your result by 255 in order to make it work.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

kippllo
Prole
Posts: 6
Joined: Sun Apr 15, 2018 2:23 am

Re: love.math.random not working on iOS in Love V 11.1

Post by kippllo » Wed Apr 18, 2018 1:48 pm

Thank you!

ronnysharma
Prole
Posts: 1
Joined: Sat Apr 28, 2018 12:57 pm

Re: love.math.random not working on iOS in Love V 11.1

Post by ronnysharma » Sat Apr 28, 2018 1:02 pm

I tried installing LOVE on my iPhone X running iOS 11.4. But the app freeze and gradually crashes itself. How to work it out?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests