Discuss Scratch

Sh4rkyuu
Scratcher
1 post

Trying to make the Sky Hop (not Sky Jump) minigame from Pou

Hi everyone, I'm trying to make a game where you have to press left or right to jump to the next platform, exactly like the Sky Hop minigame in Pou.
But I just can't figure out how to spawn the platform randomly while still creating a clear path for the player to follow for the LIFE of me. This is for an assignment due in 3 days, so any help is greatly appreciated!

Here's the link to the project: https://scratch.mit.edu/projects/1295266236
^The current blocks I'm using to spawn the platforms is referenced from a card memory game tutorial I found on YouTube.
(apologies in advance for the messy layout)
dem_bot
Scratcher
1000+ posts

Trying to make the Sky Hop (not Sky Jump) minigame from Pou

What you want to do is have a variable for the last platform x. Then every time you make a new platform you change it by
((2*width) * ((pick random (0) to (1)) - (0.5))
You then make the next platform at the new x and you can do that every time the player jumps. You do have to check if it does not try to spawn the new platform at the edge, and if it does try to, you have to change the last platform x by 2*width in the direction away from the wall.
g6g6g66g6g
Scratcher
100+ posts

Trying to make the Sky Hop (not Sky Jump) minigame from Pou

You can use a list to remember whether each position is a cloud or ground, and use that to decide the next arrangement of platforms. The list will have 7 items, which represent the alternating 3 and 4 platform layers:

2 4 6
1 3 5 7

Each item in the list can have 3 values representing 3 things:
  1. Ground (G)
  2. Cloud (C)
  3. Nothing (N)

To generate the next platforms, all you have to do is update the state of the items, then make the clones based on which list items contain ground or cloud.

How do you update the items? For starters, on the layer you're currently on, check each item. If an item is Ground, then choose between setting the previous item to ground, or setting the next item to ground, or both. For example:

C C C
C C G C

Item 5 is currently Ground. This means for the next layer you should set item 4, or item 5, or both, to Ground as well. Let's say we choose item 4. Then the list becomes:

C G C
C C G C

Now that the current layer is finished, you can generate the new Cloud, Ground, Cloud row with clones, making sure you only look at the even numbered items. And since we're on the 3 wide layer now, we should swap the two rows to switch our view:

C C G C
C G C

Now when we scan we see item 4 is Ground, and we need to decide whether to go left or right or both. But first, we need to deal with the item 5 that's already Ground. Since that was from an old layer, what we need to do first is set all of the 4 wide layer items to cloud:

C C C C
C G C

From here I think you can see the pattern: Clear (set to cloud) every odd numbered item, check every even numbered item to generate the ground, check every odd numbered item to generate the clones. Then it swaps, clearing every even numbered item, generating the ground from the odd numbered items, then making clones from the generated even numbered items.

Just a small detail that if the ground is the first or last item in the list, there's only one option for it to go next. And also you can use the Nothing option at the start of the game so the first row only has one platform. And also to keep track of whether you're on an even or odd row, you should name an “offset” variable that says which number to start on (either 1 or 2) and moves in steps of 2 from there.

If anything is unclear or you have any questions just let me know.

DEMO

Powered by DjangoBB