possible to evolve a player's mass?

miketv

• Posts: 42
I'd like to give my character the ability to upgrade his mass.

Here's the situation: my character will be encountering obstacles that can either a)stop him, b)slow him down, or c) be destroyed by him, all depending on how much mass my character has vs. how much mass the obstacles have.
The mass can be changed in 2 ways: either through purchasing upgrades in a store, or through collecting powerups in the scene.

Is there a way to do this, or is the mass set in stone?

(side question: does speed increase an object's mass in Stencyl like it does in regular physics?)

Hectate

• Posts: 4643
There's not a block to change the mass, but in theory there should be code for it. Additionally, an easier way might be to create a separate version for each upgrade level with appropriate mass settings.

Finally, all the above is just in case you're using built-in physics to determine the reaction. The easiest way to do this would be for mass just be be another number attribute of the actor, and the reaction (stop, slow, or destroy) to contact be determined by the value of that attribute (plus speed if desired). This avoids weird stuff from unexpected physics interactions as well.
 :: Patience is a Virtue,But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

miketv

• Posts: 42
Let me see if I've got this straight....

My player ("Driller") starts with a mass of 1, and the obstacles he encounters ("rock" & "block") each have their own mass of 1.

So to begin, I need to go into Driller's Events page & create a Number Attribute called "mass", & set the attribute to =1
Then I go into Rock's Events page & create a Number Attribute called "mass", & set the attribute to =1
Then I go into Block's Events page & create a Number Attribute called "mass", & set the attribute to =1
....is that right?

I'm still a little confused about how attributes work/where to apply them.

miketv

• Posts: 42
UPDATE: I think i just had a major breakthrough.
I create a new Scene Behavior, then create the attributes in there, right?

Hectate

• Posts: 4643
Nah, scene behavior wouldn't do any good. You'd use actor behaviors and attributes.

So your Driller has a mass attribute of 1. Good.

Your Rock gets a mass attribute also set to 1. Good.

Now, in your Driller behavior you do something like "When Self collides with Actor of Type Rock" you can get the Mass attribute from the rock and compare it to the Driller's mass attribute. Then, based on the comparison of the two values, you stop, slow, or destroy the actors as needed.
 :: Patience is a Virtue,But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

hailstone

• Posts: 36
hectate's solution is good, just wanna say that mass doesn't change with velocity.......... unless if u r talking about perhaps relativity and at vry high speed XD
what varies with velocity and matches with ur description is momentum, related by p = mv =]
so better to use momentum as that attribute name lol