Would This Work to Create a region....

polarpanda16

  • Posts: 83
I am working on a behavior to create a region when the screen is touched. The region's size is determined by where the touch ends/is released. I am not quite sure if the behavior I have made is correct.

This is to allow me to make multiple of one type change their animation without changing the animation of all of the same type of actor in the scene. Meaning, if they are in the region, the animation with change, if not, the animation will not change.

This is to make a conveyor belt that changes direction when touched. I am also going to try and spawn the actors inside the region as a conveyor belt at the same time, any advice as to how to do all of this, including whether or not what I have done is correct or not, would be greatly appreciated.

I have attatched a picture of the code as code blocks.
Check out my apps and other apps on the iOS App Store by searching Double Trouble Studio! Publisher of A-Mazing.

https://itunes.apple.com/us/app/a-mazing!/id542958150?

https://itunes.apple.com/us/app/drag-on/id568944870?mt=8

Hectate

  • *
  • Posts: 4643
If this is an actor behavior the X,Y positions will be relative to that actor and not the scene. If it's a scene behavior than it shouldn't be an issue.

You need to separate the "is released" from the "is pressed" event. The reason for this is that "is pressed" is only true for the very single frame/update when the mouse was just pressed. Thus there is never going to be a time where the mouse was both just pressed and just released. Separating the two will get you the new X,Y position of the mouse successfully.
:
:
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.