Rule for putting items in sequential order

rabbigarfinkelrabbigarfinkel Member Posts: 39
edited June 2012 in Working with GS (Mac)
Hello,

Let's say I want to check if items (each has a number) have been put in sequential order from lowest to highest. What would that rule(s) look like?

Thanks,

Eli

Comments

  • HC_DKHC_DK Member Posts: 92
    Are you asking for help how to solve this or just the "code"?

    What have you done so far to solve this yourselves? Have you used attributes to store the numbers or a table?

    It is not because I want to be hostile. I think that we must help each other in the community but not do the work for each other.

    HC
  • rabbigarfinkelrabbigarfinkel Member Posts: 39
    I was asking for the general direction, not the code. I'm going to go with a table. Have a nice day.
  • NovicaStudioNovicaStudio Member Posts: 174
    5 Actors named 1, 2, 3, 4, and 5.
    An Integer Attribute=How many correct?
    A boolean attribute, what slot am I?
    If self.position.x=_______
    and self.position.y=_______ then change attribute- How many correct? to How many correct? + 1.

    When how many correct = 5 then they have solved the puzzle. Maybe somebody else has a better way, but this is how I thought of it.
  • guillefaceguilleface Member Posts: 1,014
    Can you explain a little more?, but this is what I do if I want to touch 5 actors in a sequence order. So say I have 5 blocks with the numbers 1 to 5 and I need to touch them in 1,2,3,4,5.
    Create 5 Boolean global att.
    On block1 when touch is press change attribute block1 to true
    On block2 when touch is press and block1 is true, change block2 to true
    On block 3 when press and block1 and block2 are true change block3 to true
    On block4 when press and block,block2 and block3 are true change block4 to,true
    On block 5 when press and block1,block2,block3,block4 are true change block5 to true
    Now when your last block is true just set it to do what ever you want.also if you want to game over if a block is pressed in the wrong order just add a rule in the otherwise section for each block,for example lets touch block3 first, to have it game over you will need a rule. When touch is press and any of block1 and block2 is false change game over to true.
  • NovicaStudioNovicaStudio Member Posts: 174
    Well, are you dragging and dropping, or clicking? I think that is what me and guilleface are wondering.
  • simo103simo103 Member, PRO Posts: 1,331
    edited June 2012
    if what your are doing is the same as like ranking high scores then I don't believe there is an easy way around it. You will have to create an attribute for each and then compare and move as needed. For example for the highest number of three I would have is "Answer greater or equal to Attribute1 then
    Attribute3=Attribute2, Attribute2=Attribute1 and Attribute1=Answer. Otherwise if Answer is less than or equal to Attribute1 AND Answer>Attribute2 then Attribute3=Attribute2, Attribute2=Answer"

    and so on. I had to do seven numbers recently and was vary tedious but the only way I know how since we don't have the ability to sort tables.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    If you're dragging and dropping you could use an x y position for each box when the are in the correct spot and use a table to pull data for that box.
  • HC_DKHC_DK Member Posts: 92
    if what your are doing is the same as like ranking high scores then I don't believe there is an easy way around it. You will have to create an attribute for each and then compare and move as needed. For example for the highest number of three I would have is "Answer greater or equal to Attribute1 then
    Attribute3=Attribute2, Attribute2=Attribute1 and Attribute1=Answer. Otherwise if Answer is less than or equal to Attribute1 AND Answer>Attribute2 then Attribute3=Attribute2, Attribute2=Answer"

    and so on. I had to do seven numbers recently and was vary tedious but the only way I know how since we don't have the ability to sort tables.
    You can do this with tables. What you do is to add a ROW where the new number fits. I have an example-file if you like because I needed this in our game.

    - rabbigarfinkel: Sorry to use your thread.

    HC

  • simo103simo103 Member, PRO Posts: 1,331
    @henrikChristensen would be great if you don't mind sharing ... thanks. support @ funkymunkygames .com without the spaces.
  • guillefaceguilleface Member Posts: 1,014
    @henrikchristensen could you share the file with me too?
  • rabbigarfinkelrabbigarfinkel Member Posts: 39
    Great comments from all...thank you! @henrikchristensen - sorry to get snippy with you this morning, i should have my coffee before logging in! I think the idea that NovicaStudio suggested is what I was thinking of. The challenge is to put historical events in their correct places on the timeline. I'll have seven actors, each assigned a code from a table. Then I'll have seven points on a timeline, each of which has a code from a different table assigned to it. When an actor is dragged to a spot on the timeline, I will use a rule to check whether the actor's code and the timeline point's code are the same. If they are, the placement is correct.

    Is that a workable solution, or am I going in the wrong direction?

    Thanks,

    Eli
  • NovicaStudioNovicaStudio Member Posts: 174
    Yeah. You might also want to have a snap to position rule. For example, if your actor is 64x64 and a slot is 64x64, you could say if the position is at least 10 pixels around the actor, for example if self.position<100 and self.position>-100 then Move to Position- 50, -50.
    I don't know, just so they don't have to put the actor to the pixel. Hope this helps :) Be sure to like. :) If you want :)
  • HC_DKHC_DK Member Posts: 92
    @rabbigarfinkel : No probs at all. Maybe I should have finished my coffee as well :-)

    I would as @NovicaStudio check on the X and Y position.

    Are the "puzzles" static or dynamic?

    HC
Sign In or Register to comment.