Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Phaser3 Codecademy Levels: creating levels with different platform layouts

how do I create a platform generating game based on the entries of the 'heights' property of the game scene classes that are extended from Scene?

I found this on codecademy but did not understand...enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I understand now.

First set this.heights property in the level instances based on the Level class. Since the background image 3(the length of the game) is 2000 and the height is 600, we split the length into 9 sections of 220px and its height into 8 sections of 70px.

enter image description here

Therefore there are 9 numbers in the heights list, each with a value from 0 to 8.

For example: [0, null, 3, 8, 2, 4, 6, 7, 2]. If null, nothing is generated.

Then create platform generating functions based on the heights entries in the original Level class.

enter image description here

enter image description here

Now we can set different heights entries for different level instances and all these levels will have different layout. this way we don't have to place each platform for each level specifically. enter image description here

In the game: enter image description here

The one Codey is standing on might be 5, and the one to the left might be 7.

Please forgive me for any mistakes(I'm a true beginner).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!