# TBSr's General Hopscotch Coding Topic

#305

#306

Can you see something I can't? The when object is cloned block is causing a very large amount of lag, and the project doesn't recover. I cannot see why, though.

#307

@NindroidGames Nothing shown above should cause much lag. Maybe it's something else in your code that's not shown.

#308

Ok. That's what I thought. I'll just try using another object.

#309

Hello @ThinBuffalo!
I have a question. How do you make like a "stick" or something that's pointing at the place where your finger is?
I know it's something with the angle but I don't know how to do it.

#310

Hi @BB-Box
You'd use arctan.

where
Opposite = difference in Y position (touch position - stick position)
Adjacent = difference in X position (touch position - stick position)

However that only works when the angle is -90<angle<90. That's when the Touch position is to the right of (greater than) the stick position. Otherwise, using a If Then Else block, subtract 180.

I've an example on Hopscotch. Search for Point Towards by ThinBuffaloSr. I think the fūll name was Point Towards (using inverse tangent)

#311

Ok, thanks.

#312

That project helped me much. I changed the values of the ball to last touch x and y.

#313

This is the next beta version of my WIP

I'm working on a remake of the App Store's Control Tower. Just working on the basic functionality so far:

v0.1
• Can't use Move forward
• The plane emoji is rotated 45 deg
• Hopscotch's min speed of 40 is too fast (Yes, you can set it lower but 40 is the slowest an object moves)
• When you press on the plane and drag, waypoints should be created
• but only if you move your finger some minimum distance
• previous waypoint trails should be removed with a new press & drag
• The plane needs to follow the waypoints
• and continue in a straight line when it runs out of waypoints
• The waypoints need to be "recycled" so you don't run out
• this is why the project so far only uses 100 waypoints - to test the recycling
• The plane should rebound off the screen edge at the same angle of incidence
v0.2
• couldn't use clones for the planes as Hopscotch architecture doesn't allow clones of one object (waypoints) to directly reference properties of another object's clones (planes)
• both planes use the same set of waypoints to minimize the overhead required (lag)
• waypoints increased to 300. FPS stays near 60
• with 400 waypoints, the FPS begins to drop
v0.3
• waypoints should turn white if dragged over start of runway
• but only if approached from the proper direction
• waypoints should stop being placed
• Planes land when reaching the runway (if waypoints are white)
• Tried adding collisions, but bumps aren't working properly on the TestFlight app version that I now have
• To be added after new version is fixed

Known bugs

• A particular sequence causes a given plane to not start a new trail until waypoints are set for the other plane first (fixed in v0.4)
• Planes land when they're not supposed to (fixed in v0.4)
• Pressing plane and holding still until plane reaches last waypoint causes plane not to follow if additional waypoints are created while still pressed (fixed in v0.4)
• Paths that across 'landing strip' before 'approach' / 'landing strip' will land when at the 'landing strip' position without following entire path (fixed in v0.4)
v0.4
• Misc bug fixes
• Runway assignment is random

v0.5.1

• Planes fly in from sides
• Added warnings before planes fly in
• Planes restart after landing
• I dunno. Changed a bunch of stuff.

If anyone feels like testing it out, let me know if you find any bugs (or don't find any bugs) or if you have any suggestions. Thanks

#314

Specific question. Are there enough waypoints, as is, for 3 planes? (in the project above)

All planes share the same series of waypoints. This reduces the total number needed, to keep lag at bay. Once the last waypoint is used it starts back at the first one. However, if you "catch up to" an active waypoint (placed by any of the planes) then your plane can't place more until the active one(s) are removed.

Sadly, if Hopscotch worked better this wouldn't be an issue. I've already avoided the use of bumps with the waypoints as that kills the performance. But creating more than a few hundred clones also starts causing lag

I wanted to allow up to 10-12 planes which, I think, would need around 1800 waypoint clones. Hopscotch can do that but the fps will drop.

I could also accomplish the waypoints without clones using arrays, but as Hopscotch doesn't have arrays I'd need thousands of variables and a whole mess of If Then Else blocks. Not a viable solution.

2nd question. Can you tell much difference between the version below and the version above? I increased the number of waypoints to 1800. The fps dropped to ~30 so I doubled the plane speed. Net effect is it should seem similar (except waypoints won't place as closely when dragging quickly)

#315

@POMTL Would you give me feedback?

See above questions pertaining to v0.5.1 & v0.5.2.

Then compare to this version where I added 8 planes. Are there enough waypoints in v0.5.3? (play until all eight planes are going)

#316

Drawing the waypoints on v0.5.3, could definitely notice some lag. Sometimes I had to draw a few times to actually place them.

After I crashed two planes, then the game got stuck. Near the top left corner, I could see the tip of a plane on the screen flashing, but it didn't move. Then there was the warning symbol (to indicate a plane is coming) on the right edge of the screen. It kept flashing, and then I saw another stuck plane on the right edge as well.

#317

Thanks @MR.GAM3R

The file size of v0.5.2 had gotten really big, so that's probably why it didn't load. First thing I did with v0.5.3 was to run it though my cleaning program.

Was that when the plane was just entering from the edge? The ability to drag a plane was delayed intentionally, but I might have to change that.

That's all it does so far in the beta version. It just stops after a crash.

What do you think about the number of waypoints?

#318

Right, ok that makes sense.

About the number of waypoints, with all 8 planes going each a loop, it seems like a good amount. I don't know how many there were left.

#319

Just playing with different formatting for code blocks...

``````(3 backticks)

numbers 0123456789 teal
//grey
"pink"
'pink'

(3 backticks)``````

``````(3 backticks)

[pink][purple][pink][purple]
<first_word_red and the rest blue ="pink">

(3 backticks)``````

``````(3 backticks)diff

+ green
! green
- red
--- grey

(3 backticks)``````

``````First_word_teal the rest black

(3 backticks(beginning & end))``````

#320

I really like it! The graphics are cool, and the gameplay is simple yet fun. Here are a few suggestions -
- A couple more landing strips
- A how to play in the beginning
- Possibly levels (when you get to a certain point value, you could add more planes or a different scenery)
It looks pretty awesome so far, though.

#321

Thanks for the suggestions. Lots of those types of things are planned once I get the mechanics working!

What did you think of the number of waypoints (dots) in v0.5.3? Was it enough to allow for gameplay with 8 planes?

#322

I think so, although my planes crashed quite a bit . I did notice that some of the planes were landing by themselves. Is that supposed to happen?

#323

@ThinBuffalo, can you explain what the modulo block do in hopscotch?

Fantastic Modulo(s?) and how to use It(them?)
#324

Hi @BB-Box. Maybe the other topic answered your questions? If not feel free to tag me again.

Thanks @MR.GAM3R