Im using this example
// set window properties
SetWindowSize( 1080, 720, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1080, 720 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
AddSprites()
x1 = 0 : y = 116 : x2 = 600
ThisGroup = 4
do
If GetRawKeyPressed(32) `[SPACE]
If ThisGroup > 0
If SpriteRayCastGroup(ThisGroup,x1,y,x2,y) = 1
x2 = GetRayCastX()
DrawLine(x1,y,x2,y,MakeColor(255,0,0), MakeColor(255,0,0))
DeleteSprite( GetRayCastSpriteID( ))
DEC ThisGroup
Endif
Else
AddSprites()
ThisGroup = 4
x2 = 600
Endif
Endif
Print( ThisGroup)
Sync()
loop
Function AddSprites()
For x = 1 to 4
This = CreateSprite(0) : SetSpriteSize(This,32,32) : SetSpritePosition(This,x*100,100) : SetSpriteGroup(This,x) : SetSpriteShape(This,2)
next x
EndFunction
My Player and enemy are in the same group, I'm not sure if that matters
But I am just using trigger box for the collision, looks like it works ok
The code I showed above is the whole thing related to what I need.
Thanks for your time
I do need one more thing if you can?
How do you check a impulse to slow down the movement of a sprite with SetSpritePhysicsImpulse?
SetSpritePhysicsImpulse( player, GetSpriteXByOffset(player), GetSpriteYByOffset(player), GetVirtualButtonState(2)/0.10, 0.0 )