I'm making a platformer, where I want the Player to move blocks by pushing them and also be able to stand on them. I have managed to to this using detectors, but I can't make it go smoothly. The block moves when the player is like 1 pixel away from it. Any wuggestions?
n/a
Deleted User
10th January, 2008 at 12:04:06 -
Move the detector by one pixel?
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
10th January, 2008 at 12:29:33 -
Or, if that's not an option, have a second detector over it for pushing only that IS off by one pixel. That is of course not a very efficient solution, but...
Presuming that there is a seperate animation for the pushing of blocks, have you tried changing the hot spot of the character by that one pixel, too? The best way with the detectors is to have seperate left and right detectors, as well as a main body detector for your main character.
If you place the left / right detectors a few pixels apart from the body, if e.g. you are pushing a block to the right - you can test for the right-hand detector overlapping the block, and in the same event test for collision with the main body detector. That ensures a pretty secure means of pushing the block along and eliminates any juddering or gaps too.
if character is overlapping block and charx < block increase the blocks position.
if character is overlapping block and charx > block decrease the blocks position.
thats the simpleset way i did it. but if you jump on top itll move too . i forgot how i fixed that.
you could make left and right detecters to fix that i s'pose.
n/a
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
10th January, 2008 at 17:19:58 -
Originally Posted by Toxic Avenger I have managed to to this using detectors
what aren't you fine with? it seems to be working perfectly. the jerky box movement can be fixed by moving it by less pixels when pushing it.
i just threw a little platform engine together right now and its using NO detectors (one collision mask...not detectors). its got some issues but they can be worked out. i'll leave the source too. its easily capable of being expanded upon. its only 23 event lines. but it's tgf so don't ask me if you cant open the source .
left right = move
shift = jump
pushbox + enter = pick up box
enter + holdingbox = drop box
Now I've come up with a soloution that I'm fairly satisfied with. But! I want to make several blocks, without having to do new detectors and events for each block. I know this is possible somehow, spreading values...?