Skip to content

Commit

Permalink
increase paint size
Browse files Browse the repository at this point in the history
  • Loading branch information
emwangs committed May 1, 2024
1 parent 5a30583 commit 6726b32
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 47 deletions.
50 changes: 25 additions & 25 deletions assets/json/level1.json
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,8 @@
"type":"sensor",
"visible":true,
"width":0,
"x":5483.39204558157,
"y":1064.63763191115
"x":5504.60095332282,
"y":1022.21981642865
},
{
"height":0,
Expand All @@ -763,48 +763,48 @@
"y":0
},
{
"x":141.585316763646,
"x":158.516797733552,
"y":0
},
{
"x":134.133457986612,
"y":67.6970398698129
"x":150.173808379155,
"y":79.1851982296574
},
{
"x":305.526209858394,
"y":76.9284543975146
"x":342.062563530297,
"y":89.9831798064288
},
{
"x":279.444704138775,
"y":240.016777720246
"x":312.862100789906,
"y":280.747520996058
},
{
"x":286.896562915809,
"y":307.713817590059
"x":321.205090144303,
"y":359.932719225716
},
{
"x":37.2592938851701,
"y":406.182239218877
"x":41.7149467719876,
"y":475.111189377944
},
{
"x":-104.326022878476,
"y":292.328126710556
"x":-116.801850961565,
"y":341.93608326443
},
{
"x":-78.2445171588571,
"y":203.091119609439
"x":-87.6013882211738,
"y":237.555594688973
},
{
"x":-137.859387375129,
"y":147.702632443228
"x":-154.345303056354,
"y":172.767705228343
},
{
"x":-126.681599209578,
"y":58.4656253421111
"x":-141.830819024757,
"y":68.3872166528859
},
{
"x":-119.229740432544,
"y":9.23141452770176
"x":-133.48782967036,
"y":10.7979815767715
}],
"properties":[
{
Expand Down Expand Up @@ -879,8 +879,8 @@
"type":"paint",
"visible":true,
"width":0,
"x":4865.50326828368,
"y":595.985060092165
"x":4887.29141090022,
"y":452.824932838718
},
{
"height":0,
Expand Down
2 changes: 1 addition & 1 deletion assets/json/level5.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@
"friction":0.2,
"restitution":0.1,
"rotation":false,
"texture":"splotch3"
"texture":""
}
}
}],
Expand Down
4 changes: 2 additions & 2 deletions assets/json/level6.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
}],
"restitution":0.1,
"rotation":false,
"texture":"splotch3"
"texture":""
}
}
}],
Expand Down Expand Up @@ -2896,7 +2896,7 @@
"publications":[],
"restitution":0,
"rotation":false,
"texture":"splotch3"
"texture":""
}
}
}],
Expand Down
20 changes: 6 additions & 14 deletions assets/json/tutorial.json
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@
"texture":""
}
}
},
{
"name":"rotation",
"type":"float",
"value":140
}],
"rotation":0,
"type":"paint",
Expand Down Expand Up @@ -740,7 +745,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -990,7 +994,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -1160,7 +1163,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -1251,7 +1253,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -1745,7 +1746,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -1837,7 +1837,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -1927,7 +1926,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2019,7 +2017,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2176,7 +2173,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2268,7 +2264,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2425,7 +2420,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2517,7 +2511,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2609,7 +2602,6 @@
"properties":[
{
"name":"AnimationDetails",
"propertytype":"AnimationDetails",
"type":"class",
"value":
{
Expand Down Expand Up @@ -2710,4 +2702,4 @@
"type":"map",
"version":"1.10",
"width":365
}
}
13 changes: 8 additions & 5 deletions source/objects/GrowingPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool GrowingPaint::init(const std::shared_ptr<cugl::JsonValue>& json, Vec2 scale

_actions = scene2::ActionManager::alloc();
//TODO: May change per animation, if it does then parameterize in tiled
_animate = scene2::Animate::alloc(0, 8, 1.0f, 1);
_animate = scene2::Animate::alloc(0, 8, 0.5f, 1);

return true;
}
Expand All @@ -48,9 +48,12 @@ bool GrowingPaint::linkToWorld(const std::shared_ptr<cugl::physics2::ObstacleWor

std::cout << "animation asset: " <<_textureName + "_splash" << std::endl;
_animation = scene2::SpriteNode::allocWithSheet(_assets->get<Texture>(_textureName + "_splash"), 3, 3, 9);
_animation->setScale(2.5f);
_animation->setScale(2.2f);
_animation->setAngle(angle_splash);
_animation->setPosition(_selfObstacle->getPosition() * scale);

Vec2 direction_paint{(float) (40.0f * cos(angle_splash + M_PI_2)), (float) (40 * sin(angle_splash + M_PI_2))};

_animation->setPosition(_selfObstacle->getPosition() * scale - direction_paint);

if(is_out){ // if its initially out, it should have no sub
_scene->addChild(_selfTexture);
Expand Down Expand Up @@ -96,11 +99,11 @@ PublishedMessage GrowingPaint::timeUpdate(float timestep){
std::cout << "activating second paint animation" << std::endl;
_initial_splash_done = true;
auto new_anim = scene2::SpriteNode::allocWithSheet(_assets->get<Texture>(_textureName + "_splat"), 3, 3, 9);
new_anim->setScale(1.5f);
new_anim->setScale(2.2f);
new_anim->setPosition(_animation->getPosition());
_scene->removeChild(_animation);
_scene->addChild(new_anim);
_actions->activate("splat", scene2::Animate::alloc(0, 8, 1.0f, 1), new_anim);
_actions->activate("splat", scene2::Animate::alloc(0, 8, 0.7f, 1), new_anim);

}
}
Expand Down

0 comments on commit 6726b32

Please sign in to comment.