Detect a close!

So. Have you ever been coding, and wondered; what if I could code a project to detect when someone presses the home button? When someone locks their device? Welp now you can! I’m not sure what uses this actually has, so please reply with any suggestions/comments.
Here’s the project:
https://c.gethopscotch.com/p/ztuo4wqga
Basically I use a simple program to find your current framerate, then use that to find the average FPS, and test if the current FPS dips way below the average, precisely as it does when hopscotch goes off-screen. Very simple, very useless. Enjoy.

22 Likes

Wow, great job!
Although the close thing isn’t the most accurate, it only will say that once I turn on and off the iPad, not when I exit Hopscotch.

4 Likes

Huh it works entirely for me just fine

Even when I try to remix but then go back it still detects something happened

4 Likes

@tankt2016 What does your FPS in the bottom right corner say most of the time? Just curious to see how that effects the projects performance, because it works in both my new iPad, and on my ancient iPhone.

1 Like

49, 50, 51. It keeps bouncing between those.
Also, I exited the app, didn’t turn off my iPad, and went back into the app, and it worked fine. It detected the app was closed.

1 Like

ok mr rex but did you check my post i gave you in the colbl topic?

i reloaded the page on the laptop version and it restarted the count back to 1.

1 Like

That is really cool! It reminds me of the “restart detector” that @CreationsOfaNoob made a while back.

2 Likes

So the question is:
Any practical uses??

2 Likes

How does the statement that makes the text say “The project was closed” work??

2 Likes

If you want a project that was time based, like “catch as many coins as you can under 60 seconds”, maybe the game could pause when you leave Hopscotch? And then, when you came back, you would be presented with a screen like “Would you like to continue playing or start over?”.

2 Likes

Yes, very cool @William04GamerA, that’s a great use. Also, I noticed this project got unpublished, and I might of deleted it accidentally. I’m trying to recreate it now, but I can’t get it to work again!

2 Likes

Yes of course!
When you reopen the project, COAN’s “clock” could recalculate the timestamp - I may use that for E-Pad, assuming it can hold its framerate

I actually thought of this before and I was surprised to see it done, though I haven’t checked the project and hope it is easy to recreate.

btw is it possible to do this without framerate measure?

2 Likes

There is no need to worry about losing that project.

  1. Click on that link that you have in your first post, and Open it in HS.
  2. Play and publish.
    Bam fixed!
    btw I stole the code mwahahaha
1 Like

The problem is it doesn’t save as a draft. And it doesn’t give me the option…

1 Like

Wait from me? Right now?

1 Like

If you open the link, it will take you to the project. Press play, the there is a publish button
yes I have a draft of it without the remix bar LOL (I won’t steal credit you can trust me)

2 Likes

Thank you. I did not see that…

1 Like

Nice edit lol it’s ok

2 Likes

WAIT. That’s how you can steal projects… if you have the code and they unpublished it, it’s yours…

1 Like