How to defien wall collision in random generate map. #980
-
|
What I have so far.
I draw the sprites on an invisible canvas then convert it to an image as a source for |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
|
What version are you using?
…On Fri, 19 Dec 2025 at 19:19, ParkCorner ***@***.***> wrote:
What I have so far.
The map is a multi-dimensional array with 0 as floor and 1 as wall.
If print it in the console, it could look like this.
############################################################
############################################################
#######........########......##############....#############
#######........########......###########.......#############
#######........########......##########..................###
######........................#########..##....####......###
######.#######.########......##########..##....####......###
######.#######.###########.###########...................###
######.#######.###########.###########...#########□##.######
######.#######.###########.###########...############.######
######.#######.###########.###########...############.######
######.#######.###########.###########...############.######
######.#######.###########.###########...############.######
######.#######.###########.###########.........######.######
######.#######.###########.###########.........#####....####
######.#######.######.......##########.........#####....####
##.............######.......##########.........#####....####
##.............######.......###########........#####....####
##.............######.......###########.############....####
##..........................###########.############....####
###########....############.###########.#############.######
###########################.###########.####################
###########################.###########.####################
###########################.###########.####################
#####........................................###############
###.......#################.##########..#####........#######
###.......############.......#####......#####........#######
###.......############.......#####......#####........#######
###.......############.......#####......#####........#######
###.......############.......#####......#####........#######
###.......############.......#####......#####........#######
###.......############.......#####......#####........#######
###..........................#####......#####........#######
###.......############.......#####......#####........#######
###.......############.......#####......#####........#######
########□#############.......#####......####################
##################################......####################
##################################......####################
#######################################.####################
############################################################
I draw the sprites on an invisible canvas then convert it to an image as a
source for sprite() so the whole map is one GameObj. The next thing I'm
working on is to prevent player from walking into the wall. While I came up
with a work around to place rectangle or polygon around the edges, the
frame rate become unstable.
So I want to ask. Is there a better way to set the boundaries in random
generated map without sacrifice the frame rate?
—
Reply to this email directly, view it on GitHub
<#980>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHIYW4MDWF6GPRMYAUNCP34CPGLLAVCNFSM6AAAAACPQ2OHJGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZZGI3DGNRYGU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Kind Regards,
Marc Flerackers
Software Engineer
|
Beta Was this translation helpful? Give feedback.
-
|
3001 is for people coming from kaboom, it is 100% compatible with kaboom, but also unoptimized like kaboom. |
Beta Was this translation helpful? Give feedback.
-
|
If you are on 4000, set the broadPhaseCollisionAlgorithm, because default is Sweep&Prune. This is good for endless runners or horizontal platform games, but not for games stretching in both dimensions. // broadPhaseCollisionAlgorithm: "quadtree", |
Beta Was this translation helpful? Give feedback.
-
|
Additionally you can set the narrowPhaseCollisionAlgorithm too. Default is "gjk", which supports curved shapes. If you don't need this, "sat" may be faster. If you only uses boxes (rectangles), you can use "box". |
Beta Was this translation helpful? Give feedback.
3001 is for people coming from kaboom, it is 100% compatible with kaboom, but also unoptimized like kaboom.
You need 4000 if you want performance.