Changing a players collision group at run time

When my player moves in the left direction it flips on the horizontal axis because i only have an animtaion that allows the player run right. But the problem is that the collision box stays in the same position. I was wondering how i could change the coordinates of the collision group as i have tried using the command:

sprite.set_hflip("player#collisiobobject", self.move_input < 0)

but this didn’t work

Looks like you’ve got a spelling error, have you checked that?

i messed around with it and made some new code:
I found these 2 lines in my program which are used to set the players direction:

		if speed_diff < 0 then --lines 62 and 64 set the acceleration to work in the direction of the difference 
			acceleration.x = -move_acceleration
		else
			acceleration.x = move_acceleration
		end

so i added the lines:

		if speed_diff < 0 then --lines 62 and 64 set the acceleration to work in the direction of the difference 
			acceleration.x = -move_acceleration
			self.direction = -1
		else
			acceleration.x = move_acceleration
			self.direction = 1
		end

at the end of the update function i wrote:

	if self.direction == -1 then
		sprite.set_hflip("player#collisiobobject",true)
	end

But this also didn’t do anything for some reason.
(I did find the error in the URL of the collision, atleast thats where i thought it was lmao
)

You still have this in your URL, is that intentional?

collisio_b_object

1 Like

yep it shhould be there lmao

Oh, it shouldn’t be “sprite” for a collisionobject.