Spawning objects using the screensize attribute

I am spawning object using random(35,screenSize - 35) for where they spawn on the X, but they are spawning outside of the screen. I am trying to build the app for all devices so I figured screenSize would work, should I use sceneSize instead?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @pixelstix There aren't any default attributes in GSC called screenSize or sceneSize... not sure where you're getting those from....

    You have game.Display Size.Width (and game.Display Size.Height); as well as scene.Size.Width (and scene.Size.Height). Use either one and it should work out.

    PS Welcome to the GSC Forums. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • pixelstixpixelstix Member Posts: 6
    If I go into the section where I am going to spawn the actor and I go to select where on the X axis, I go devices > screen > size >width / height. Does that not return the screen size of the current device running the app?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2013
    If I go into the section where I am going to spawn the actor and I go to select where on the X axis, I go devices > screen > size >width / height. Does that not return the screen size of the current device running the app?
    D'oh, yes it does, you're perfectly right! Have your first "Insightful" for that! :-) (It's 1.40am here in the UK so I'm a bit tired; that's my excuse and I'm sticking to it... :D )

    However, for whatever reason, you say it's spawning outside the screen area, so try Game > Display Size > Width to see if that works for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • pixelstixpixelstix Member Posts: 6
    Well thank you sir! :) I am not sure if its the player or the issues with where they are spawning. I changed it to Game >Display Size > Width/Height and I am still getting issues. But when I hit Preview and it runs, everything runs perfect. But when I hit the Play button next to the Stop button it spawns them sometimes outside of the scene. Is this an issue with GS or something else?
Sign In or Register to comment.