Advanced Question- need help- place position??

Mr HansonMr Hanson Member Posts: 94
edited October 2012 in Working with GS (Mac)
Good day all.

I have seven actors in a coloum facing vertically. So they are in top of each other. This is meant to be my power up area.

What i need to work out is how I can create a system where they know what number they are in line.

Because when one of the seven is used, it will active that power, destroy that power actor that just got touched and the actors above it need to move down by 100 to fill in the gap.

Then a new random power up will be created but it needs to know it is at the end if the line hence it will be number 7.

Is this possible?

Further info:

I tried a quick demo where there were two actors and when the bottom one was touched it got destroyed and the other one was set to interpolate to the other position. Am I able to interpolate self. Y position to self.y position - 60?
I tried and it went straight to negative 60.

I would prefer of it all could be done using Seven actors as this is how many different powerups I have.
Also I am working on previous version of GS currently until apple fixs my issue.

Thanks, and help would be great even if it's "give up" because that will make me find a way to prove it is posible.

All the best
JonApp

Comments

  • Mr HansonMr Hanson Member Posts: 94
    The interpolate is now working, forgot you can't use self. position when dealing with it.
    Again any help would be helpful, otherwise i guess i am on my own.

    All the best
    JonApp
  • gamesfuagamesfua Member Posts: 723
    Hey there! Not entirely sure i understand what you're trying to do but thought i'd try to pitch in. It appears (and correct me if i'm wrong here) that you have 7 objects stacked on top of one another. The problem you're facing is that you need the computer to understand where each of these 7 objects are as they move down the stack. Sound right? Well what if UNDERNEATH each slot (7 slots for eac actor) you put an invisible actor (basic square actor). Then just say- when actor x (one of your real slot actors) overlaps with invisible dummy actor y, do xyz (whatever you need it to do). If you think about this idea it should open up a lot of ideas on what you can do with it. You could track where a slot item/actor is on the column. You can have it easily move position on the column (i.e. If Event x happens and actor x is on slot 3 then interpolate position of actor x to slot 4) and so forth. Hope this helps!
  • gamesfuagamesfua Member Posts: 723
    One more quick note- If you combine my solution above with attributes it becomes even more useful. For example- when actor x overlaps with invisible actor in slot 2, set attribute boolean x to be true. Or whatever. Idea being having attributes can help track things and allow you to do otherthings in the game. I.e. When boolean x is true have actor y do xyz.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    As you move the actors up and down you can determine their 'power' by their position on the Y axis of the scene. Try something like:
    Constrain Attribute: (self.myPower) To: (ceil( self.Position.Y/self.Size.Height ))
  • gamesfuagamesfua Member Posts: 723
    RThurman's suggestion is probably better and better on resources.
  • Mr HansonMr Hanson Member Posts: 94
    @anatomyofdreams and @RThurman

    Thanks for trying to help

    I can get the powers to work, that's not a problem, I just need it so that when they are on top of each other and for example the bottom power is activated. That actor will be destroyed and I need the rest of the other actors/powers to move Down and replace where the other one is,

    I tried a simple way of doing it where it involved gravity and that it collides with each other and the invisiable wall. However the more that were on top of actors the more they got pushed into the the actor in front.

    All the best
    JonApp
  • gamesfuagamesfua Member Posts: 723
    How's this for a try. This should work.
    WHEN ACTOR IS DESTROYED (your power actor in the slot) set boolean X (attribute) to TRUE.
    Now inside each of your power actors in the slot, say...
    When boolean x is TRUE- CHANGE POSITION Y-60 (and or however many pixels they need to move to the next slot).
    This will make all of the powers slide down into the next slot. That should do it. Make sure to set the boolean back to FALSE after they slide into position, that way they can be triggered to TRUE again for the next round.
    Work?
  • Mr HansonMr Hanson Member Posts: 94
    Ok thanks @anatomyofdreams

    However any of the seven can be touched, so if the third one gets destroy i need only four five six and seven to move,
  • gamesfuagamesfua Member Posts: 723
    I can pretty much guarantee you that other, more gifted, experienced people on these forums will be able to help you better than I. That said, I'll give you an idea of how I'd do it. It's pretty much exactly everything I said above WITH ONE EXCEPTION!
    You put invisible actors underneath each power actor. These invisible actors act as invisible means to tell where the user touched. Let's make this easy for now and just use two stacks. So there's one column with two stacked actors atop each other. You have invisible actor 1 and invisible actor 2. Both are placed on top of one another. 1 is on top. 2 on bottom of it. Now create 2 BOOLEAN attributes for each (we'll call these slot1 and slot2). On start of level set both to TRUE. I'm using TRUE to indicate that the slot is currently active.
    Now here's where the trick comes in. There is essentially two buttons we have here (on top of eachother). A power button and an invisible slot button. When user taps on FIRE he is in theory also tapping on INVISIBLE ACTOR 1. So two things will happen here.
    1.) Whatever you have associated with tapping FIRE will happen. I.e. a spell is cast or whatever.
    2.) When user taps on INVISIBLE SLOT 1 (which is really underneath it), turn boolean to FALSE.
    3.) Put this line of code in all of your power actors... WHEN SLOT 1 Boolean is FALSE, change position y to whatever down.

    Now I know what you're saying. But what if I tap on slot 3 or 4 or whatever. Simple.
    Just make a rule inside each actor that when (lets say) slot 3 boolean is false, only power actors above slot 3 will move down. Etc. You get the idea.

    Now another question you might be having is HOW do we know where a power actor is on the slot? Well you can say that when FIRE overlaps INVISIBLE ACTOR 2 that it's internal attribute (self attribute-which you'll have to make) changes to 2. And so on.

    Does this make sense?
    Again I'm sure someone's got a much simpler way around this, but wanted to make sure you weren't left hanging!
    Cheers!
  • Mr HansonMr Hanson Member Posts: 94
    Wow thanks for helping @anatomyofdreams and @RThurman

    I don't quite get it because some of it I seem impossible to do so I decided to ask some simple questions and then add it all together.

    1. What rule would I use or how can I tell if the slot is false judging from the actors number. So if actor is number 4, how can i say a rule that it recognizes I'd slot 5 is false. So if the game.(self. Slot +1)
    So if self was 4 it would look for rules in 5. If self was 2 it would look for 3.

    2. I tried a completely simpler way where I added gravity and then have zero bounce and have a rule that they collide with each other. They also have a rule which says when touch destroy self. There is a base that is non moveable which they can also collide with. Having only two actors stack works fine. However when more are added they go under each other a bit and go back to normal. Or if I destroy the first three the other four fall down but bounce a little with each other. What's going on there. I even watched all demos to make sure I was doing it right.

    Thanks due helping everyone

    All the best
    JonApp
  • Mr HansonMr Hanson Member Posts: 94
    Thanks guys, I worked it out only using one actor that is placed seven times, and it works. :) had to use a table.

    However if two are done at exact time it only moves down one square, not two, for some reason it doesn't check again and go down. Everything else works fine. Any advice would be great.

    All the best
    JonApp
  • gamesfuagamesfua Member Posts: 723
    I'll answer this in a few hours!
  • Mr HansonMr Hanson Member Posts: 94
    Thanks @anatomyofdreams

    I have started and have been going alright, but to be clear what i am after am after this:



    I have one column and they move down when pressed but if i select more than 1 it doesn't work like the video.

    Thanks for any help

    All the best
    JonApp
  • gamesfuagamesfua Member Posts: 723
    Sorry I'm getting back so late. I'm busy with sound processes on my game. Not sure what the answer is for this one. I think you're using tables now-which I haven't really dived into yet. You may need to look around for more answers. Personally the solution I provided above, I think, will handle your problem because it detects where objects are in the slot. Thus will allow you to say IF block x is on slot y move to position xyz. And I think it will also be able to handle multiple touches. If your game is similar to another game, I would post a conversation on this forum saying, "Need to be able to do X like in the game Y" That may help get you the people you need! Hope this helps and good luck! I'll keep thinking for you. If I find anything I'll let you know!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @JonApp
    Now that you have decided to use tables -- this might help. (Its not exactly what you want, but could point you in the right direction.)

    http://www.mediafire.com/download.php?eax12hx13t8c7ql
  • gamesfuagamesfua Member Posts: 723
    Yeah I gotta brush up on tables. I always hated Excel. That's probably what's preventing me. ;) Thanks RThurman
  • Mr HansonMr Hanson Member Posts: 94
    @RThurman and @anatomyofdreams

    Thanks for the consistence replies.

    I am trying to do what the video above does, I have it so that one block can get destroyed but when ever more than one gets destroyed the blocks only move down one tile, they don't go all the way.

    If you need for info can you PM or anything.

    All the best
    JonApp
  • ShineyGamesShineyGames Member Posts: 157
    edited October 2012
    This is going to be probably the stupid reply of the month.
    if you carn't get it work, could you not just use gravity?
  • ShineyGamesShineyGames Member Posts: 157
    Like This? or am i completely off



  • Mr HansonMr Hanson Member Posts: 94
    @ShineyGames

    That was our first attempted but when they collide on top of each other, they bounce even if bounceness is set to zero on everything. We then paid for someone to fix it but they said they can't because it's just the way GS dies things and that we should look for another way. That's why we are trying to find a work around. So no it wasn't a stupid question.

    All the best
    JonApp
  • ShineyGamesShineyGames Member Posts: 157
    I did feel silly posting :)
    on i side note they don't seem to bounce on the demo i knocked up
    but only set the acceleration 100
  • Mr HansonMr Hanson Member Posts: 94
    Just saw video, yes that's what we were looking for however if you add more and change them to a different colour and maybe change the gravity to a different speed.
    What we noticed was that they showed a bit of bounce and movement. We were hoping for something smoother.

    All the best
    JonApp
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @JonApp
    Think again about the table demo. It it closer than you may realize. And it will point you in the right direction.

    Did you notice that the two blocks with the "0" end up all the way to the left. And the blocks with numbers move all the way to the right (in the correct order). If you can do it with numbers, you can do it with colors.

    Perhaps you didn't notice because it happens too fast? You can always slow down the sequence.
  • Mr HansonMr Hanson Member Posts: 94
    @RThurman

    Yes I did notice it and I do say thank you. However all I need is what the video I posted does, I am looking at yours and thinking of ways to make it know when something is destroyed, i know how to make actors go in order, I just need it like the video, if you can help it would be great.

    Or further explain you demo more if you think I can do it there.

    All the best
    JonApp
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    The "0" represents a "destroyed" actor. But you don't really destroy it. You just make it invisible. Any other number represents an actor that is visible.

    Try putting a new rule in each actor:

    When attribute [self.myCellValue] = [0]
    --Change Attribute [self.color.alpha] To: [0]
    otherwise
    --Change Attribute [self.color.alpha] To: [1]
  • ShineyGamesShineyGames Member Posts: 157
    just made this (not tables) just move to
    1 actor but 12 rules!! you can destroy the actor, but i just moved it up so you can see whats going on.
    Ive got a feeling your better of with tables (i dont understand them yet)
    but this is an option for you




  • Mr HansonMr Hanson Member Posts: 94
    @ShineyGames

    Yes that is what I wanted, hopefully it works the way I want. However looking into tables as well. Sent you PM.

    @RThurman

    Thanks, I better understand now of what is happening. I begin an five hour shift tonight so I should be tackling this bad boy.

    All the best
    JonApp
  • Mr HansonMr Hanson Member Posts: 94
    Thanks for helping managed to do it, using one table and an actor. Works great,
    Thanks for sticking around and helping.

    All the best
    JonApp
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited October 2012
    Glad you got it working!

    Now -- how about sharing your new-found powers. Tell us how you solved this.
Sign In or Register to comment.