Character behavior

Luyren

  • *
  • Posts: 1947
That's because your "SetRandom" is only called after a movement is ended. If your boolean is false when that happens, nothing is calling SetRandom again, so your actor won't move.

Your axis check should not set a boolean to true. Instead, it should constantly set the X and Y positions of the actor back to the limit (if X > 240, set X to 240). That would be the idea.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles and many more.
Twitter

chongyunxiang

  • Posts: 235
Thank you so much! I've made it to always set the axis back to a certain number if it surpasses it. Initially, it was still getting stuck, but I removed another set of blocks that were in the movement trigger events (there was an if statement that checks if the pet is more/less than a certain X axis). Removing that makes it much better.

I've attached a screenshot the blocks i've used in case anyone wants to take a look or spots any mistakes.

chongyunxiang

  • Posts: 235
I've faced with another problem, the happiness bar.

I'm trying to tie in the Happy and Hunger bar together. Over time, the Happy bar will reduce. The Hunger bar will also reduce. If the hunger is below 20, the pet will begin starving. When it's starving, the Happy bar will decrease faster.

I'm not sure why what I've done doesn't work and it causes the Happy bar to reduce almost immediately.

Luyren

  • *
  • Posts: 1947
When updating executes 100 times per second. You are triggering "Starving" 100 times per second. I'm sure you can see the problem with that.

Also, on your created event, as soon as the "do every" is triggered once, it will execute til the end of time. You should have that "if"statement inside of it, not outside.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles and many more.
Twitter

chongyunxiang

  • Posts: 235
I've gotten the Starving behavior to work! Thanks!

Now when the pet is dirty, it's supposed to Every Few Random Seconds display the dirty emoticon, but it keeps triggering every second. I'm not sure where it went wrong. I tried creating separate behaviors or events for it, but it just keeps triggering every second instead.

Luyren

  • *
  • Posts: 1947
Two things I noticed at a quick glance:
1- You are using multiple Updating events. It's better to use only one, and use the comment blocks to indicate what part refers to what.
2- The bottom Updating event on your screen shot has a "do every" block on the top of it. You are triggering 100 "do every" instances per second, it will throw all your timings out of whack, and likely creating the result you are seeing. Don't use a "do every" in that case.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles and many more.
Twitter