Detect a close!


#1

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:


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.


#2

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.


#3

Huh it works entirely for me just fine

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


#4

@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.


#5

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.


#8

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


#9

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


#10

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


#11

So the question is:
Any practical uses??


#12

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


#13

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?”.


#14

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!


#15

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?


#16

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

#17

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


#18

Wait from me? Right now?


#19

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)


#20

Thank you. I did not see that…


#21

Nice edit lol it’s ok


#22

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