Determine if script is run on iPhone or iPad? (SOLVED)
Is there any way to determine if a script is run on an iPhone or an iPad?
I'm creating a game and I want it to be able to run both on an iPhone and an iPad.
Like for instance:
self.width = 60 if run_on_ipad else 30
Why not base the size of your alien on the x/y dimensions of the screen, which you can get from the Scene module, instead of a specific device model?
You could use the <code>size</code> property of your scene. Have a look at the bundled "Clock" script for an example. It uses different margins, line widths, etc. depening on the type of device (iPad/iPhone).
The bundled "Cascade" game uses a similar approach to determine the number of tiles that fit on the screen.
Thanks guys! I used the same approach as the one used in the "Cascade" game.
from scene import *
ipad = WIDTH > 700
self.width_and_height = (60,60) if ipad else (30,30)
def draw(self): image('Alien_Monster',100,100,*self.width_and_height)
global WIDTH; WIDTH = self.size.w
self.alien = Alien()
def draw(self): self.alien.draw()