marklovers / kaplay

🦖 A JavaScript game library
https://kaplayjs.com
MIT License
230 stars 14 forks source link

bug: object disappears randomly #181

Open appsdevpk opened 1 week ago

appsdevpk commented 1 week ago

Describe the bug

I followed the documents on the site and built the sample game successfully. But a very strange thing is happening, the bean object disappears randomly when touching the ground on load or during game play. I am using firefox latest version on windows 10. Here is my code, https://gist.github.com/appsdevpk/27d199c654e9bd2d89f3c226d126b224

A clear and concise description of what the bug is.

Version

v3001

What version are you running?

To Reproduce

create the basic game from docs and open in firefox.

Steps to reproduce the behavior:

1.

Expected behavior

the object should stay on screen

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

mflerackers commented 1 week ago

Could you try with lower gravity? If the frame rate is too low, the object may be tunneling through the floor. Did you check the position of the bean once it disappears?

appsdevpk commented 1 week ago

first time the gravity was 1600, and its still disappearing after lowering the gravity to 1000, here is the video of game play. https://drive.google.com/file/d/1mcuZjnS7-Z1Wyeb8IW2Q7uh2tp_1phCc/view?usp=sharing

mflerackers commented 1 week ago

Is it just the movie? or does it run that slow? Also, what are the coordinates of the bean when it disappears?

appsdevpk commented 1 week ago

its just the movie, i cannot find the coordinates when it disappears

lajbel commented 1 week ago

it looks a framerate on your end problem, can you tell us the frame rate (F1 for debug mode) also debug log every frame the player position will help too

lajbel commented 1 week ago

Also browser and device help too

appsdevpk commented 1 week ago

here is the pos i got, { x: 528.1152000000111, y: 317796.730481202 } i am using asus laptop with 24gb ram, Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 2.59 GHz windows 10 and firefox latest version

mflerackers commented 1 week ago

Do you have the pos.y and vel.y right when it leaves the screen? That y looks very large.

appsdevpk commented 1 week ago

yes thats the right one, and the velocity i am getting is { x: 0, y: 36519.520000000346 }, besides this issue, the lib is awesome, i have tried many libs before and never found any interesting lib

mflerackers commented 6 days ago

Try making the floor 480 pixels high instead of 48. You're tunneling through the floor and then gaining speed I think. This is due to having a low frame rate. what is weird though, is that there is a velocity limit, so it is impossible to reach the velocity you get if you were using kaplay. Are you sure you are not using kaboom?

appsdevpk commented 4 days ago

i am using kaplay from cdn (https://unpkg.com/kaplay@3001.0.0-alpha.17/dist/kaboom.js), i changed the floor height to 430 but still having the same issue