Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - HiperDoo

Pages: [1]
1
General / Jittering in Player Sprite and Camera Movement
« on: October 10, 2021, 02:43:10 am »
Hi, I'm starting a little game and I'm having some basic problems with jittering. My project is a bit long, so I simplified everything into a single main.cpp with around 250 lines of code.

https://github.com/HiperDoo/Jittering-Problem

I tryed to make the camera always follow the player and that the camera can move smoothly when the player accelerates and when brakes hard. And it works, the bad thing is that there is a very annoying little jitering (and its not solved only by placing a maximum speed, since you can see the jittering when accelerating and decelerating).

I really tried a lot of convinations with the std::floor(), std::round() and std::fmod() functions. I've been trying to solve it for 3 days.

An example (obviously you can't see the jittering in an image):


I would be REALLY GRATEFUL if someone could modify the code I made to fix this jittering pleace.

#Details:
   - The TileMap and the red box (player's hitbox) are drawn on the same Render Texture and moved with the camera. The player sprite is drawn in the window using "mapCoordsToPixel" from the hitbox (for some reason a jittering occurs, even having the same coordinates).
   - There are 3 factors to take into account, the movement of the camera, the hitbox of the player and the sprite of the player. There is jittering between the camera position and the hitbox, also between the hitbox and the sprite (terrible :().
   - The player's sprite must continue to be drawn outside the tilemap's render texture (I want to make modifications to it without altering the tilemap, in addition to being scaled).

2
General / Glitter Effect with Blur
« on: May 10, 2021, 11:44:57 pm »
Hi! This is my first question on this forum, I hope you can help me...

I'm doing different parts of a 2D game that I have to finish for a school project.

I have a very good idea for the design of my game, but after much searching on the internet and through this forum I did not find something that worked for me either because they have not asked it or because it is outdated.

The point is that I need a way to blur a texture, for example to have Cube 1 to Cube 2 (done in JavaScript):


I would need to make the effect of blur and also modify the brightness of it to make it look better.

I would be very grateful if someone could pass me a little code that can do this (a few days ago I realized the existence of shaders) and because I have very little time to finish it.

(I can't blur the textures from the .png because they are 16px textures and because it would be too heavy)

Thank you!!!

Pages: [1]
anything