TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
Updating attribute
Pages:
1
Updating attribute
grove
Posts: 8
June 21, 2022, 03:58:16 pm
I have a situation where I want the following:
when attribute A passes a number divisible by 100 attribute B increases by 1
I could make a series of code like "if A = 100" and if "A = 200" etc. But that seems cumbersome.
I have made a code that goes "if remainder of A /100 = 0" but this will only increase B if A is exactly divisible by 100. If attribute A jumps from 96 to 102 this won't activate.
Suggestions?
Luyren
Posts: 2747
June 21, 2022, 04:52:05 pm
Code:
[Select]
Set B to [floor of (A/100)]
That's all you need. Floor is an option in the "round" block.
My Stencyl resources are available here:
https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter
grove
Posts: 8
June 21, 2022, 06:08:34 pm
Thank you!
grove
Posts: 8
June 26, 2022, 04:31:00 pm
Follow up.
This sets attribute B to a fraction of attribute A, using an updating code.
But I can't then add B to attribute C as this results in C rapidly increasing in number. How do I pass B as a static number to C?
Luyren
Posts: 2747
June 27, 2022, 09:51:41 am
https://youtu.be/j10SMwy2prM
This video should help you understand how the Updating event works, as that seems to be the issue you are having.
My Stencyl resources are available here:
https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter
grove
Posts: 8
June 27, 2022, 05:51:16 pm
Nope, sorry, that was no help at all.
Luyren
Posts: 2747
July 01, 2022, 05:50:21 am
Unless you post a screenshot of the code you attempted, there's not much help to be given. There is a camera icon on the bottom right corner of your behavior you can use for that.
My Stencyl resources are available here:
https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter
Pages:
1