GameSalad

favorite system

WeiyuWeiyu Posts: 177Member, PRO

Hello everyone, I have a problem about favorite system.

I need a favorite system, but I have no idea how to make it.

Like this:


my behavior:

When touch pressed (heart)
Change Attribute "Game.favorite A" is "true"
//At scene 1

f Attribute "Game.favorite A" is "true"
Spawned Actor "A"
//At scene 2


↑↑↑ but I can't control the actor position

For example: If I touch A's heart, It will spawned A at scene 2 (50,50), then I touch B's heart, it will spawned B at scene 2 (100,50).

But turn upside down ...
If I touch B's heart, It will spawned B at scene 2 (100,50), then I touch A's heart, it will spawned A at scene 2 (500,50).

I want to let they follow sequence, could someone tell me how to do that, plase?
How to make a favorite system? Thank you.

Comments

  • pHghostpHghost London, UKPosts: 2,062Member
    edited August 18

    Umm, not sure what you mean?

    In most favorite systems, nothing moves, but the heart icon just gets filled up with colour or so. Just change the graphic of the favourite button!

    Can you explain more what you actually want to happen? Explain it from the position of the user, not code.

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef
    edited August 18

    Are you wanting only one item to be "favorited" at a time? So that if they click the heart next to song A and then click the heart next to song B, only song B will be favorited?

    If you just want that sort of radio button style selection, here's a demo attached (only the first 5 songs are configured).

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

  • WeiyuWeiyu Posts: 177Member, PRO
    edited August 19

    @pHghost @tatiang
    I am sorry I didn't say it clearly.

    I mean I want to make a favorite system.
    if I touch actor's heart (add to my favorite), it will spawned a actor in favorite scene.

    this is my idea:

    My problem is that I have no idea how to let actors spawn and sort by time in favorite scene.

    Sorry for my bad English, I use the picture to explain, I hope you understand what I mean, thank you!

  • pHghostpHghost London, UKPosts: 2,062Member

    That should actually be relatively easy to achieve, all you need is one table. Whenever you like something, add a row to the table at the end and fill in the info. That way, it will be ordered from top to bottom.

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

    @Weiyu said:
    Sorry for my bad English, I use the picture to explain, I hope you understand what I mean, thank you!

    The pictures help so much! Now I understand.

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

  • WeiyuWeiyu Posts: 177Member, PRO
    edited August 19

    @tatiang I'm glad you understand what I mean :D

    @pHghost said:
    That should actually be relatively easy to achieve, all you need is one table. Whenever you like something, add a row to the table at the end and fill in the info. That way, it will be ordered from top to bottom.

    I've tried making favorite system by your advice, it is very awesome, thank you for your advice!
    But I still have some questions.

    Q1: How to let heart(add to my favorite) spawned actor in favorite scene by add table's row ?

    Q2: Do actors will move up when I cancel the heart(cancel my favorite)?

  • pHghostpHghost London, UKPosts: 2,062Member

    It will depend on the details of what you are doing, but the short answer is yes, it will work.

    A1: You can do this is several ways. One is, if you have a maximum amount of favourites items, you can have all the actors there already (let's say 5 per page). Create a self attribute in the actors self.favorite_index and then change it for each actor, with 1 being at the top, then 2, 3... You don't need to unlock the actor to uniquely change its self attributes, so don't unlock it, that would cause more confusion!

    The actor will then fill itself with information from the table, from the row that = self.favorite_index.

    Then, first line of logic, if self.favorite_index > tableRowCount() you will either destroy or make invisible the ones that aren't filled (destroy if it's a separate scene, otherwise make invisible).

    Alternatively, if you want to spawn them, put only one in there and put this logic inside: if self.favorite_index < tableRowCount() spawn another copy of me Y distance lower. You will also ned to make sure that the index is +1 in each new copy, of course.

    A2: Just use the add/remove row to do this. If you use the first method in A1, it will automatically make invisible/destroy the removed item. If you are spawning them, just add logic to destroy any that have a self.favorite_index > tableRowCount() and you are set.

    When adding rows to the table, you add them at the end, but when moving them you will need to remove them At Index, to remove the right one.

Sign In or Register to comment.