Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Problem: Raycasting for a platform player controller

Author
Message
c0d3r9
User Offline
Joined: 2nd Oct 2017
Location:
Posted: 21st Feb 2018 13:54 Edited at: 21st Feb 2018 13:57
I try this down under and the sprite often flickers or have jerky movement.
(YOU HAVE TO PRESS LEFT/RIGHT A WHILE TO SEE WHAT I MEAN)
I don´t know if i i´m on the right way because after some nights with physics for platformer i must found another way



Attached the simple source with media to present only that problem.
I hope someone have a tip.

Attachments

Login to view attachments
Lucas Tiridath
AGK Developer
9
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 21st Feb 2018 21:00
I believe that your sprite "flickers" because when it moves over the join between the tiles, the ray cast down fails to hit anything at all, and so the value returned by GetRayCastY is placing the sprite of the screen. In the long run, you probably need to do something about the collision on the tiles to make sure there are no gaps, but a quick fix would be to use your posy variable to cache the last value, and simply continue to use that until you get a new good value.


Hope that helps.
c0d3r9
User Offline
Joined: 2nd Oct 2017
Location:
Posted: 22nd Feb 2018 03:16 Edited at: 22nd Feb 2018 13:55
[href]null[/href]Yes thats a very good idea.
For now i have change the Tileset and load it via Atlas.
All fine, but the sprites still jerking on the slopes.
I post the complete code...make some comments.
I know that the ray jumps from pixel to pixel and now i have headache because i have no idea how to make the movement/sliding smoother without jerking.
Attached the source to take a look in action.



Edit: have changed the x speed to


It seems to work.
But always the sprites are jittering.And it is no problem with code because i saw that on different games made with AGK.
Have test it on my Laptop how i code and on my desktop pc.Same jittering.

Maybe i should open a new thread for that, because i seems i´m not the only one with that problem.
Thinking about tweening between two moves....not sure.

Short before i give up......vsync(1) seems to solve the stuttering.
Hope it is the solution for ever.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2018-09-20 09:59:19
Your offset time is: 2018-09-20 09:59:19