Why does my p5js game not work for iPhones?

So I got everything to display on my iPhone 4 by eliminating two js bugs.

First I had a couple functions which I set a default value for the parameters. Apparently this is a no-no in js but Android and PC let it slide. If you use default params in js they have to be of the ‘null / false’ variety.

Second, I used a few for loops of the following variety:

for (let card of cards) {
    card.x++;
}

These didn’t work and I switched them to:

for (var i = 0; i < cards.length - 1; i++) {
    cards[i].x++
}

I figure this is an iPhone4 thing cause it’s old and that is a newish for loop.

This got everything to at least display, but not to start the game. I’m using ‘weinre’ to get a console output from the phone (but it’s not outputting what I’d expect it to, like: console.log(“hello world”);, or error messages ).

My function “function mouseClicked() {do stuff}” doesn’t seem to do anything. It’s supposed to start the “loop()”. However something sends the message “start ios!” to my console whenever the screen is touched.

My googlefu has been unable to decode the meaning of this message (“start ios!”). It’s probably incredibly simple. Does anyone know what it means? Btw: this is the only console msg my phone has sent over ‘weinre’, and I don’t know why :frowning:

Through the ‘weinre’ console on my PC I can send the “loop()” command to the phone and the game will start up. “mousePressed()” seems to work to move the character around although the iPhone4 runs it very slowly…

Maybe tomorrow I’ll migrate the “mouseClicked()” commands to “mousePressed()”. I tried a quick solution tonight, but it was unfruitful.

Any feedback is appreciated.

Anyone know what this “start ios!” console output is about? Lastly Chrome doesn’t output that message to my console. Only Safari.

1 Like