0 Favourites

How do I add score for pickup on different objects

  • I have 3 different size disks - small, medium and large. On start of layout a blue star is created for each and every disk, then pinned to that disk. When the player rolls onto a disk and is overlapping a star it adds to score. But since these different sized disks can overlap each other, as if they were on different layers (they are on the same layer) how can i differentiate what star is pinned to what size disk?

    Example - large disk with star is worth 1000 points, medium = 2000, small = 3000.

    If there are 2 large disks, one on top of another, and a small disk underneath those two large disks, and the player rolls onto the top most large disk, he should score 5000 points. Large =1000 + large = 1000 + small = 3000.

    I know i'm going to need a variable, but i can't seem to get this right, since . . . well . . . i don't know what the hell i'm doing.

    Any help is immensely appreciated.

  • How I would do this depends on how much the star matters. Can you overlap a disc without a star being on it for less points? If each disc always has a star pinned to it then the star doesn't really matter does it and is only a visual thing, it's just the disc that matters and you award points based on the disc type being overlapped.

  • You can get the pinned UID when you use the pin behaviour.

    For instant:

    On start of layout
          Pin object_1 to object 2
    
    On key pressed 'A'
         text1.text = str(object_1.Pin.pinnedUID)  <-- (Will set Text1.text to the UID of object2, you can use this to pick the correct disc and then get the correct size/score)
    
    [/code:1v4hxh6y]
  • How I would do this depends on how much the star matters. Can you overlap a disc without a star being on it for less points? If each disc always has a star pinned to it then the star doesn't really matter does it and is only a visual thing, it's just the disc that matters and you award points based on the disc type being overlapped.

    Damn it plinkie - you just made my brain hurt. I never even thought of it like that. Always the wise one.

  • You can get the pinned UID when you use the pin behaviour.

    For instant:

    > On start of layout
          Pin object_1 to object 2
    
    On key pressed 'A'
         text1.text = str(object_1.Pin.pinnedUID)  <-- (Will set Text1.text to the UID of object2, you can use this to pick the correct disc and then get the correct size/score)
    
    [/code:32ofe0x5]
    

    You can see how i the stars and disks overlap.

    There isn't a key press. The game will use tilt for the gameplay and On Tap Object - Play - that will take the user to the main layout. This is how i have the pin event right now:

    I just made 3 more families - LgDisk, MdDisk and SmDisk. So i should be able to change and add 2 more events for - System - For each LgDisk/ MdzDisk/ SmDisk.

    And forgive me nimos100, i'm not understanding your text1.text = str(object_1.Pin.pinnedUID)

    Can i trigger that with - LgDisk > On Created?

    Thank you for the replies.

  • plinkie

    On 2nd thought, the star does matter. If there was no star then the player would only have to come into contact with the disk to score. With the star the player needs to make it to the center of the disk.

    Besides, people love collecting things.

  • Because you are pinning the star at image point 0 the origin, you can say when the player overlaps the disc at image point 0 as well.

  • You could make 3 identical star objects and put each in a container with a different disk. That will make the star pick the right disk automatically (if you pick by object. It doesn't work by family). You will also make a star spawn automatically (though you will still need to pin it) whenever you spawn a disk.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • [quote:1w6l5982]I just made 3 more families - LgDisk, MdDisk and SmDisk. So i should be able to change and add 2 more events for - System - For each LgDisk/ MdzDisk/ SmDisk.

    And forgive me

    nimos100

    , i'm not understanding your text1.text = str(object_1.Pin.pinnedUID)

    Can i trigger that with - LgDisk > On Created?

    Sorry was just using a textbox as example.

    My point were as you pin one object to another, the object that you pin the object to can be received, since that is the case you can get the size and thereby add the correct score.

    Here is a simple example:

    https://dl.dropboxusercontent.com/u/109921357/Get%20pinned%20UID/Get_pinned_UID.capx

    If you click one of the stars (Blue circles) you get a text showing its UID and the UID of the disc that its pinned to as well as the size of the disc. Which if I understood you correct would decide the score.

  • plinkie calebbennetts nimos100

    Thanks for all the help. At the start i was just planning on the AllPlats and Stars giving a general score, but since decided to try and add combos.

    This is why i think i need to pick the size of the disk.

    And i forgot all about containers. Gonna try and get the logic right for the ComboMultiplier.

    Thank you again for the help. Much appreciated.

  • calebbennetts I can't use container since the parent disk is destroyed with the star. May have to add a few events for each disk/star.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)