James Bass Davies
James Bass Davies

Reputation: 408

Phaser varied sprite length

I'm quite new to Phaser, and here is my issue:

I currently have a game in which platforms are generated varying on the Y axis. Currently I have created 3 platforms that vary in length.

Each platform is assigned a value 1/2/3 and called from a RNG function along with its y axis position.

So here is my question, is there a way I could create a "Start" and "End" platform, with a varied length intersection ?

Thus adding a greater randomisation factor to the game.

I have tried to use an anchor and scaled the image based on an example however it seems to distort the image.

Therefore, is there any other way in which this can be completed?

Upvotes: 0

Views: 87

Answers (1)

sdfsdf
sdfsdf

Reputation: 5610

Well, you can just keep creating sprites from (x: start, y: height) to (x: end, y: height) and add those sprites to a group that has physics enabled like is said in this post.

You could also try making a tile map, set one layer to collide with, and then you can just add tiles to the collide layer.

And of course you can just use a for loop to add the sprites or you can also set a timer event to add a sprite every x milliseconds until it reaches a set counter limit.

Upvotes: 0

Related Questions