So confused...

AlphaCentoriAlphaCentori Member Posts: 57
edited August 2014 in Working with GS (Mac)

Hi

I want my hero to change weapon when he collides with a power up.
I also want to have as many power ups i want. For this example let's say i have 3 power ups.

I've tried so much combinations my brain can't function anymore. I've got one member that helped me a lot
but her example (template) had only 1 power up so she used a boolean attribute which was fine for 2 weapons.

But if i want to switch between 3 weapons can i do it with boolean or i must use interger?

Please help me, it's been almost 48 hours i'm on that issue.
Thanks a lot to this amazing community.

Sincerely
Dom

Comments

  • quantumsheepquantumsheep Member Posts: 8,188

    Make an integer attribute called 'weapon type'.

    When the player collides with the power up, change 'weapon type' to random (1, howevermanyyouwant)

    On your player have rules that say:

    If weapon type = 1
    Spawn 1 bullet

    If weapon type = 2
    Spawn 2 bullets

    And so on and so forth.

    Hope that helps,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • AlphaCentoriAlphaCentori Member Posts: 57
    edited August 2014

    Here is what i have up to date:

    http://www64.zippyshare.com/v/22675850/file.html

    The power ups capsules drop randomly every 1 sec and that works.
    But once it collides with the player ship that's where i'm stuck with which logic to use.

    My power ups capsules are already determine. I have a red, blue, green, yellow.....and they all have a unique effect. So i don't need to determine randomly what each capsule will do. I just need to know how to tell:

    If player has weapon 1 and collides with power up 3 change weapon 1 to weapon 3.
    If player has weapon 3 and collides with power up 5 change weapon 3 to weapon 5...

    Is that possible?

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    @AlphaCentori very possible
    Pretty much what @quantumsheep‌ said.
    Make an attribute in your hero and make it an attribute.
    then make rules like this

    If player collides with power up 1

    Change attribute self.weapon to 1

    If player collides with power up 2

    Change attribute self.weapon to 2

    and so on

    Then have rules for each weapon

    if self.weapon = 1

    (rules and behaviors that go with this weapon)

    if self.weapon = 2

    (rules and behaviors that go with this weapon)

  • AlphaCentoriAlphaCentori Member Posts: 57
    edited August 2014

    Guys i'm about to throw my machine off tha stage!!! :\

    If i create an attribute in my hero how do i make it an attribute??

    I've tried to create an interger attribute calle "weapon type"

    But how do i give weapons an identity? Do i just select the weapon actor

    then create a rule select attribute choose self.wepon type = 1

    is that how i identify my weapons?

    Then in the hero i say if hero collies with Level 2 Power Up change self.weapon type to 2

    If that's what i got to do i did it and it's not working

    In addition to create an integer atribute do i have to create the same attribute in my actor?

  • AlphaCentoriAlphaCentori Member Posts: 57

    @quantumsheep said:
    Make an integer attribute called 'weapon type'.

    When the player collides with the power up, change 'weapon type' to random (1, howevermanyyouwant)

    Where do i change "weapon type" to random?

  • AlphaCentoriAlphaCentori Member Posts: 57

    Dude i just want my hero to change weapon is that so complex?

  • AlphaCentoriAlphaCentori Member Posts: 57

    You guys explain things like we newbies will catch the missing parts....like

    "just create xyz minus 5 plus delta 4 divided by the attribute of the cube metrix...."

    Come on man!

    You have to tell me where to create things in steps i'm not a designer, i'm not an engineer.

  • AlphaCentoriAlphaCentori Member Posts: 57

    In my hero i created a rule saying:

    if hero collides with power up level 2

    Change attribute --> Self.Weapon type --> 2

    but how do i identify my weapons? How do i tell the weapon actor you are number 1, you number 2, you number 3.....

  • AlphaCentoriAlphaCentori Member Posts: 57

    @RossmanBrothersGames said:
    AlphaCentori very possible
    Pretty much what quantumsheep‌ said.
    Make an attribute in your hero and make it an attribute.

    Come on man! Make and atttribute and make it an attribute??? What is this?

  • AlphaCentoriAlphaCentori Member Posts: 57
    edited August 2014

    Finally got it! Searched for tutorials on youtube plus your guidance did it. Sorry my tantrum.

  • Andrea_ComisiAndrea_Comisi ItalyMember Posts: 328

    @AlphaCentori said:
    Finally got it! Searched for tutorials on youtube plus your guidance did it. Sorry my tantrum.

    Here is the multi power up template updated :
    https://www.dropbox.com/s/rthbiy2v30qs9qc/template.zip

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    Glad you figured it out, when first learning and things aren't working its good to slow down and think, "what am I not telling the system to make things work properly" I find it helpful to stop and think through each feature in the game and ask "what is gamesalad going to need to be told in order to make this work?" Gets easier the more familiar you become with gamesalad

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    You need to watch my GS logic series.

Sign In or Register to comment.