How to drag 9 spawned actors independently - EXTRA CHALLENGING

jorkosjorkos Member, PRO Posts: 353
edited January 2012 in Working with GS (Mac)
Hey guys, thanks in advance.

In my iPad game on one scene, I spawn an actor (bees) multiple times so that there can literally be 20 bees flying across the screen at once. I want to allow the user to drag up to 10 bees independently using the touchpoint data. I'm struggling to figure out how to do this correctly. Are there any examples of this or templates that have this that I can purchase? Thanks for your help guys, really appreciate it.

Totally stumped

Comments

  • CloudsClouds Member Posts: 1,599
    10 bees ! Independently ! They will certainly have their hands full (literally in this case) - I can't help you with your question as this is something I am trying to learn at the moment too, but I admire your ambition ! (I am trying to work out how to access and control 2 touches and I thought I was getting out my depth with just that ! lol !!).
  • jorkosjorkos Member, PRO Posts: 353
    Hey guys, I figured out how to do this, thought i'd let you know:

    - create game level attributes for each independent bee (bee1, bee2, etc.)
    - create independent bee actors
    - on bee1, if touch1x & touch1y land within actor, change bee1 game level actor index to 1 and constrain position to touch1x & touch1y.....etc.
    - when bee1 is released, reset game level attribute to 0

    This works well although i'm concerned that creating these extra actors and game level attributes will slow everything down but i couldn't figure out another way....
  • jorkosjorkos Member, PRO Posts: 353
    hey guys, just wanted to post a follow up on the best way to do this.....I believe it is to use a self attribute (ie. self.touch)

    - when touch is pressed and self.touch =0
    - if touch1x & touch1y fall w/ x&y position of actor, use drag rules according to touch1x & 1y and set self.touch to 1
    - when released, set self.touch to 0
    - do this for all 10 touch points so that for example if touch8 is pressing actor, those are the touch points dragging it....
  • GreenHavenGamesGreenHavenGames Member Posts: 62
    Jorkos;

    Did you get this working? Did you use a single actor using a self attribute or did you make 10 actors? I would gladly pay for a generic working template that allowed an actor to spawn multiple actors that could then be dragged by multiple simultaneous touches. Heck, I would even love to see a template that allowed two objects to be drug around separately.

    thanks...
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    i dun understand one thing, how could you drag 10 actors at one time??
    all ten fingers at work?
  • MotherHooseMotherHoose Member Posts: 2,456
    @GLGames … ah today, isn't your normal day … all ten fingers or two or more players …

    @GreenHavenGames … all touches, at any place on the screen, register.
    and, as we can't get more than one mouse click to register … this is confusing

    make a newProject … one Actor …
    set its Alpha to O
    make as large or larger than screen display
    Rule: when
    Event: touch is pressed
    --displayText: game.Touches.Touch 1.X .."\n".. game.Touches.Touch 1.Y

    Preview your work in GS Viewer and what happen

    @Tynan … you always get me … =))

    @};- MH
  • jorkosjorkos Member, PRO Posts: 353
    hey @greenhavengames yes i got this working after some playing around; i am thinking of selling the template for the whole game or parts of it but that's not really my focus so haven't spent time on it. but yeah, at a high level, what i did was associate a self attribute with the first touchpoint (you check each touchpoint against the index of iPad touchpoints and if the beginning falls within that touchpoint (ie. touch7x&7y - you change the self attribute and have a rule that does offset drag on those touchpoints) - after a lot of playing around i found that the order you put them in makes a difference. but yeah, the end result is that you can drag 10 actors independently with fingers. ok yes i should make this template but it is kind of hairy
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    woot!! multiplayer dance dance revolution? lolz
  • jorkosjorkos Member, PRO Posts: 353
    hey guys, just to follow up, I just submitted the template to the marketplace - not sure how long "in review" takes but let's hope it's not as long as apple ;)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Do you have it set up for all possible touches? Remember that you never know which touch (1-11) will be used to grab which bee. If you look at the joystick controller template made by GS and found in the new section you'll see how they handle this. You'll see that it is quite complex. I created a two player multitouch iPad game Called Blobs Attack! that uses a modified version of the GS joystick demo and it works well but it is quite tedious.

    Good luck!
  • jorkosjorkos Member, PRO Posts: 353
    yes it's set up for all touches, that's the main point of the template - hopefully they will allow it for sale....
  • GreenHavenGamesGreenHavenGames Member Posts: 62
    Thanks for all your input. I look forward to seeing your template jorkos!

Sign In or Register to comment.