Wrap X & Y on a screen area that is actually smaller than the phone screen

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited January 2014 in Working with GS (Mac)
Hi all

Quick question?

Can you in Gamesalad Wrap X/Y on a part of the game screen or will it only work on the whole screen.

I'm only asking as I have a graphic of an arcade machine over my main play area and the screen that the action appears is only x/y big so was wondering if my asteroid style game will work correctly if the visible game screen area can have the correct Warp x and Wrap y?

I currently have the whole iphone screen as wrap x and wrap y.

Thanks in advance :)

It takes a Zombie to know a Zombie!!!

Comments

  • slowcutslowcut Member, PRO Posts: 164
    Hi, the wrap behavior will only work for the whole screen, in your case you have to rebuild a custom wrap x/y behavior manually... but this will be no big deal. Build it once, and add the rules to a group and add this group to your custom behaviors and then use it for all your actors by dragging it to them from the custom behavior list
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    edited January 2014
    lol how do i create a customer x & y behaviour?
    Hi, the wrap behavior will only work for the whole screen, in your case you have to rebuild a custom wrap x/y behavior manually... but this will be no big deal. Build it once, and add the rules to a group and add this group to your custom behaviors and then use it for all your actors by dragging it to them from the custom behavior list
    Hi Slowcut again!

    Your always to my rescue! :)

    lol how do i create a custom x & y behaviour?

    It takes a Zombie to know a Zombie!!!

  • slowcutslowcut Member, PRO Posts: 164
    There are a lot of ways... use your imagination...
    For example create separate attributes for left/right/up/down limits and set their values to your virtual screen borders, and if actors position x > right limit, change x position to left limit and vice versa, do the same for y axis and up/down limits...
    There you go
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    lol sounds complicated

    I get the setting up the attributes for right, left,up & down...but how would it know say, if the ship went off screen at x position 300 it would know where to come in from the left...how would it know how high it was in the y axis?

    It takes a Zombie to know a Zombie!!!

  • slowcutslowcut Member, PRO Posts: 164
    In every rule you can record the x and y position and transfer it to the opposite side of the screen, you can also compare the positions to the relation of the middle of the screen and transfer it, to get a real wrap behavior if your movements are not only in a straight horizontal and vertical direction
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    ok, thanks Slowcut...will give it a go :)

    Thank you for your help as always

    It takes a Zombie to know a Zombie!!!

  • slowcutslowcut Member, PRO Posts: 164
    For example, your virtual screensize is 512x512 and you are developing for iPad portrait (768x1024) and your virtual screen is in the middle of the real screen
    Left limit: 768/2-512/2 = 128
    Right limit: 768/2+512/2 = 640
    Upper limit: 1024/2 + 512/2 = 768
    Lower limit: 1024/2 -512/2 = 256

    Rule: if self.positionX. > right limit
    - change self.positionX to left limit
    - change self.PositionY to 1024/2-(self.PositionY-512)

    if your actor leaves screen at x: 640, y: 600 it will be moved to x: 128, y: 424
    If it leaves at x: 640, y: 300 it returns at x: 128, y: 724

    Adapt this for X< left limit and Y > upper limit and Y < lower limit

  • quantumsheepquantumsheep Member Posts: 8,188
    That's some great advice from slowcut.

    Personally, I like to use physical borders. For example I have four actors, labelled left, right, top, bottom.

    These are placed outside the main screen, a little distance off from their respective edges.

    In each 'enemy' I have the rules:

    If you collide with right actor, move to the left side of the screen (coordinates).
    If you collide with left actor, mover to right side of the screen (coordinates).

    And so on.

    The trick is to make sure when they hit an actor, not to place them so they immediately hit the opposite actor (which is why I place them a little away from the edges!)

    My game, DotMatrixx uses this for the enemy movement/placing - it's free if you have a Mac: https://itunes.apple.com/gb/app/dotmatrixx/id481691880?mt=12



    Hope that helps!

    QS =D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hi Slowcut and Quantumsheep.

    That's great advice from both of you. I will try and get the game working now and it was bugging me as I've left the project alone for ages as just couldn't get the thing working properly.

    Thank u both for your advice and time... :)

    It takes a Zombie to know a Zombie!!!

Sign In or Register to comment.