How can I TOTALLY stop an actor from moving?

LIBERADO

  • *
  • Posts: 2659
But what I can do is create a brand new file that's super generic. Then if I post that and anyone who wants to jump in and look for the best way to handle this issue ...
Ok, I want to see how the game freezes.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

double3

  • Posts: 131
hello. so with the help of a fellow super-talented Stencyl-er, i *thought* we finally squashed a super frustrating physics bug in my game last night. we did TONS of testing via the Flash player and the bug never happened. so it was a happy WIN ... well, until i pushed the game to my iOS device. the bug very quickly happens there. and i'm literally about to punch my computer and/or walk away from Stencyl for good. no joke ... about the leaving Stencyl part. just not worth it with the constant crashes on my Mac, and this stupid bug that seems truly impossible to fix. dangit.

in a nutshell ... my game has the player shooting a ball that lands on slanted and flat tiles and rolls until it comes to a stop. except it doesn't truly come to a stop on iOS ... but it does in the Flash player. why? please please please tell me why. is this a known issue with physics? is it a problem with Stencyl? or iOS?

thanks. sigh.

SadiQ

  • Posts: 1780
How do you detect is the ball stops? Can't you check if it's speed is "close enough" and stop it with code? Have you tried changing the friction and the bounciness of the ball?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

rob1221

  • *
  • Posts: 9424
You should continue this on your previous thread as you're just going to get the same questions asked that you did last time.

I have no idea why you're getting different results in iOS compared to Flash, and it's not an issue I've seen reported before.

double3

  • Posts: 131
I realized that after posting. My bad. I just quickly did it in a moment of frustration without thinking through the better approach of continuing my other thread. Is there a way to combine them ... or should I just copy and paste into that thread?


double3

  • Posts: 131
Threads merged.

Thanks, Rob!  That was fast!  :)

double3

  • Posts: 131
So here's my latest code to stop the ball. Again, it seems to work perfectly when testing in the Flash player ... but NOT when testing on my iOS device (iPhone 6).

I will be forever grateful if someone can figure this out. I feel like I've tried every possible tweak to fix the issue ... but maybe I'm missing something ... or maybe it requires some magic ninja skills that I simply do not have. I'm a UX/UI Designer and Front-end Web Developer. So super hard-core code and logic doesn't jive with my brain.  :D

* FYI ... a friend suggested that maybe I look into creating my own gravity instead of using the default Stencyl physics. But I haven't researched that yet. And I gotta imagine that would be crazy hard!


rob1221

  • *
  • Posts: 9424
If turning off physics is an option for your game, then you could just change animations to remove the collision shape entirely, and change animations back when you need to move your ball.

ETHproductions

  • *
  • Posts: 430
Creating your own gravity shouldn't be very hard. I've done it several times for platformer games on which I've worked. All you have to use is "set y-speed to (y-speed of Self + [small number goes here]) for Self".

You may also want to consider creating your own friction. You could set friction to 0 for the actor, then use code somewhat like this to slow the actor:

if (OnTile)
  if (x-speed of self >= [small number goes here])
    set x-speed to (x-speed of Self - [same small number goes here]) for Self
  else
    set x-speed to 0 for Self

Hope this helps!

« Last Edit: May 22, 2015, 09:13:34 am by ETHproductions »
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

SadiQ

  • Posts: 1780
set x-speed to (y-speed of Self + [same small number goes here]) for Self

Mistake there?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

ETHproductions

  • *
  • Posts: 430
Whoops, good catch! Fixed. :)
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

double3

  • Posts: 131
Thanks for the ideas, everyone. I'll try them tonight and report back what I find. If the ideas work ... the first round of beer is on me. Just need to find a spot that works for everyone. Hmm. I'm in Nashville TN.

« Last Edit: May 22, 2015, 08:56:00 am by double3 »

Hectate

  • *
  • Posts: 4643
I had a similar issue for Hamsterball Golf where the ball didn't want to ever really stop rolling, even with regular friction. It didn't help that I wrote my own friction code I guess, but my solution was to just cut it off once it reached a low enough number and set all those values right to zero.

Funnily enough, on the desert stage with the long slope the friction was enough to stop the ball on the slope... so that's the only scene that friction was actually entirely disabled, hah.
:
:
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.

double3

  • Posts: 131
... my solution was to just cut it off once it reached a low enough number and set all those values right to zero.

Hmm. Not sure what you mean ... but it sounds like you did exactly what I did in the screenshot I posted earlier. Can you please review that and compare to your code? And even better would be if you could post a screenshot of your code. Please.