You can try this clamp:
clamp(lerp(Self.X, (Player.X+d*cos(a)) , 5*dt), Player.X-MaxDist, Player.X+MaxDist)
clamp(lerp(Self.y, (Player.y+d*sin(a)) , 5*dt), Player.Y-MaxDist, Player.Y+MaxDist)
I don't quite understand what are you trying to do with those clamp() expressions, but they won't work like that.
If you don't want the camera to go further than 100 px from the player, set MaxDist to 100. Also, try to increase camera speed in event 3 - change to "10*dt" for example.
I don't understand why you had to add those conditions. I don't think they change anything, because at least one of them is always true, so there is no point in them.
I made some changes, have a look:
dropbox.com/s/sazmpsmexk4mmn5/RightStickCam.c3p
EDIT - Actually, this version may be better:
dropbox.com/s/ocyz4hzyiqdt3zf/RightStickCam2.c3p
You are probably using a condition like "Is Button down" or "Is in touch". This conditions are executed on every tick, 60 times per second.
You need to use a triggered event, which is executed only once. They usually start with "On" - "On key pressed", "On touch start" etc.
Ok, I fixed it, see this demo:
dropbox.com/s/7rrjq240qvwsykq/slider-pulsar2.capx
dx and dy can be instance variables on the sprite, or global variables. I tested this code and it definitely works.
Here is the easiest way:
On Touch start Set dx to (Touch.x-Sprite.x) Set dy to (Touch.y-Sprite.y) Is in Touch Sprite set position to (Touch.x-dx, Touch.y-dy)
You can set a tag in Solid properties for the wall object, and use "Set solid collision filter" action to make enemies ignore solids with this tag.
Press F12 in the browser and see if there are any error messages in the console log.
Develop games in your browser. Powerful, performant & highly capable.
jatin1726 Try this demo:
dropbox.com/s/hnhepai660anaf4/ScrollingListOfPlayers.capx
Sorry, I don't understand. You can rotate the image left and right many times, not just once.
Member since 26 May, 2016