How would you affect specific actors on screen only, then sequentially only affect others.

FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148
edited March 2015 in Working with GS (Mac)

So I am currently trying to work on a project where, different ships come in and you swipe to make them do different things. So there is a constant stream of them coming in from the side of the screen. I have made this swiping method from this thread I recently opened: http://forums.gamesalad.com/discussion/80819/how-would-you-make-2048-style-swiping#latest In which when a swipe left, right, or down is registered, it activates the Left, right, or Down game level attributes to true for about a second.

So you have enemies coming into a line, being continuously spawned off screen, and swiping is going to make the actors to different things, but only one swipe will be performed on each actor and then thats it. How would it eve be possible to make it so that when you swipe the screen, it only affects the actor thats in front of the line, and then after something has been done with that actor, your next swipe will affect the one before it in the line (most of the time there will be multiple of these shown on screen), and then after something has been done with that one, your next immediate swipe will affect the one before that in the line, all while they are coming in.

I cant even begin to think how this would be possible. Anyone have any ideas?

I really appreciate it,
TJ

Comments

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Does nobody have any ideas on this?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    You can use overlapping region actors and detect collisions or you can determine it by self.Time (how long the actor has been on the screen). Can you post an annotated screenshot of your game so we have an idea of what it looks like with the actors lined up? You'll need to upload the screenshot to a file-sharing service and then embed or post the link here.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Sorry I'm away on phone right now, but I did kind of explain it confusingly before. Basically, you have continuously spawning actors coming in all at the same speed in a single file line from the side of the screen, you can either swipe left, right, or down, each will do something different but that is irrelevant. Each actor will take one of these three commands and that's it then it doesnt matter what happens to it.

    My point is, I need to come up with away to make it so that when you swipe on screen (left, right, or down) it only affects the one in front of the line, then when you swipe again (left right, or down) it will affect the one that is now in front of the line, and so on and so on.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    My point is that I need to see what the game looks like to know how best to suggest something. ;)

    I get the general idea of your game but it matters a great deal, for example, whether your actors are spaced out a bit or not all the same size, or on the screen only when a certain number of them are visible, etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Ill try to get a screenshot when I get back.

    As far as distance I don't know, but I have one actor spawning about every second, and that time progressively gets less and less. .8, .6, .4 As well as the speed increasing. But they are all the same size, and never touching, and always moving at the same speed together minus when the speed increases for all of them. They are never touching. Id say probably at most you'd ever have on screen at once is 6.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    I would increase an integer game attribute (game.spawnNum) by 1 just prior to spawning each actor. Then in the actor, change self.myNum (integer) to game.spawnNum. During testing, you can display self.myNum to make sure it's working. That should give the first actor a value of 1, the second 2, etc. Create an integer attribute called game.lowestNum and set its default value to 1. Check to see if self.myNum = game.lowestNum and if so, "do something" with that actor and change game.lowestNum to game.lowestNum+1 to allow the next actor to be "active."

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    In the last sentence, did you mean to write "change game.lowestNum to game.lowestNum"

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Nope... sorry! Fixed above.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Haha didnt think that was the case... :)

Sign In or Register to comment.