Problems with collisions
-
In my game when both are false the player passes through the wall idk what to do now :P
-
Is your player movement code via setSpriteLocation() or setSpriteSpeed()?
Where is your collideSprites() sitting? This should come shortly after your movement code, in my experience. -
Setspritelocation i removed the setspritespeed and i placed the colidesprites before the player movement code let me test is changing the place of the colidesprites can change the problem
Edit: still don't working :P -
I have found setSpriteLocation() can override the collision. When using that function, I need to instead detectSpriteCollision(), I think that's the right one, and then move the player myself if detected. It won't naturally block him from moving.
If using setSpriteSpeed() then follow it with collideSprites(), it will naturally block the player from moving.
-
But i think with the setspritespeed i can't make playet controls so i probably will need search a bit to find how to use the detectspritecollision :P
But thanks that helps me a lot and probably in future fuse updates see if is possible correct that problem with the sprite location and sprite colision -
I think that works as intended. You have one way, where Fuze detects and you code the effects. Maybe you want to bounce the player or teleport him. The other is use Fuze built-in effect of blocking pathing.
-
@landein207 i think its just a matter of getting used to how you set out code, il be less busy tomorrow if you wanted me to share a program demonstrating how to work with collision ?
-
Yes plz that may help me
-
Ok i was testing the controls with setspritespeed instead of setspritelocation the collision works but the movement looks like sliding in ice.
how can i avoid that effect in the movement? -
I’ve never used setspritespeed, so I don’t know the exact way, but if you ’spritespeed *= 0.8’ at the end of your loop somewhere, that’ll work like friction..
-
I think i will open a new topic for that but thank you for the friction 'command'
-
If you decide to use setSpriteSpeed(), what you ought to do after the collision event happens is then stop the player from moving yourself.
setSpriteSpeed(player,150,0)
col = collideSprites(player,wall,false,false)
if col.exists then
setSpriteSpeed(player,0,0)
endif
-
@Jongjungbu that code setSpriteSpeed(player,150,0)
col = collideSprites(player,wall,false,false)
if col.exists then
setSpriteSpeed(player,0,0)
endifIt will make the player get stuck to the wall :P
-
Iv made a collision demo for you download code NDL89RND5U
-
Well, I sort of simplified it. But maybe check out waldron's example :)
-
@landein207 the demo is pending but should be available soon.
-
Ok thanks for helping me understanding how collisions work here :)
-
That has been approved
-
Lightning ⚡ fast :)
-
@waldron Express delivery!