Stencyl 3.4.0 is now out. Get it now!

Stencyl logic and help from experts

Steven70

  • *
  • Posts: 42
I'm developing a simple children's game for about a month and I'm learning Stencyl "making" it. I approach the problems when they occur and with the manual in front of me I find the solutions. I'm already a little familiar with block programming and I just need to turn logic into something that Stencyl can understand.
But there are some things that I do not understand in the block programming of Stencyl. Although I can achieve this, I would like to understand better.
For example, in the image I've posted, the two blocks do no more than activate a simple drag & drop (an object, once clicked, follows the mouse).
To activate the event correctly I had to create a counter that checks whether an object can be dragged or not.
What does not convince me is that both instructions could be placed in one block. The yellow part of the second block, in my opinion, could be inserted in the first block (IF BLOCK)
But what happens if I do it?
If I leave the code so (as in the attached image), the object will follow the mouse correctly. If I insert the part of the code in yellow and move it into the first block, the object will follow the mouse but in an incorrect way.
In the end I achieved the result but not following a logic but by attempts.
What do you think about it?
Is there an internal priority in Stencyl that suggests breaking the code as much as possible without putting it all together?
Thank you

colburt187

  • *
  • Posts: 2129
You could do it the way below, but you would still need the other box for the click sound logic.

SadiQ

  • Posts: 1749
So your question is why you can't put the yellow part inside the If Mouse is pressed on self
It's all about when and how the code runs inside those events.
 The Updated event runs 100 times per second, so the code in it runs that many times, but the code inside a Click event only runs when the mouse is clicked, and it runs only once.
The code you have right now is the correct way of achieving what you want.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

LIBERADO

  • *
  • Posts: 2489
You can do it this way:
   
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Steven70

  • *
  • Posts: 42
Good, thank you very much for example and help!