theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Nested issue with scaling the wrong character #435

Closed benloh closed 1 year ago

benloh commented 2 years ago

In GitLab by @jdanish on Sep 4, 2022, 10:22

In this code:

// whenever the fish is touching an algae
when Fish touches Algae [[
  // do the rerst of this once every second (instead of 30 times a second which is too much)
  every 1 runAtStart [[

    // first, take the energy from the algae
    prop Algae.energyLevel sub 10
    // next have the fish gain some energy
    prop Fish.energyLevel add 10
    // finally, make the fish glow so tha we know something is happening
    featProp Fish.Costume.glow setTo 4

    // if the algae is out of energy, it is dead so make it
    // faded and inert which means it won't interact with other things
    // also set it to be really small so we know it is just the leftover bits
    ifProp Algae.energyLevel lte 0 [[
      prop Algae.alpha setTo 0.5
      //featProp Algae.Costume.scale setTo 0.1
      prop Algae.isInert setTo true
    ]]

    // if we have turned the grow feature on
    // grow if above 90% energy
    ifExpr {{ (Fish.getProp('grows').value) && (Fish.getProp('energyLevel').value > 90) }} [[
      dbgOut 'growing'
      // STUDENTS_MAY_CHANGE - this is the logic that makes large fish use more energy, so changing the energyUse in here is something we might want to do
      featProp Fish.Costume.scale setTo 0.7
      prop Fish.energyUse setTo 2
    ]]
  ]]
]]

If I leave in the line that says “Algae.Costume.scale setTo … ” then it scales the fish, an not the algae. The rest of the code appears to wok in that that algae gets the alpha and inert not the fish.

This is in the art-assets commit 4d8f3cdc8b7a6181d695258b7ec55f396174af62 within the fish character in the aquatic model

benloh commented 2 years ago

A simple featProp call will demonstrate this problem:

# BLUEPRINT Block
...
when Block touches Fish [[
  dbgOut 'hoho'
  featProp Fish.Costume.glow setTo 1
]]

When Block and Fish touch, it's Block that glows, not Fish.

This also a problem in:

These work though;

benloh commented 2 years ago

mentioned in commit 725b95020ffd53010850e060ff1d69dc9995bf64

benloh commented 2 years ago

@jdanish This should be fixed with 725b95020ffd53010850e060ff1d69dc9995bf64 Please confirm and close.

benloh commented 2 years ago

mentioned in commit 3614624da17188c1bd4453b43c9053d94543e719