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?
10th January, 2008 at 12:04:06 -
Move the detector by one pixel?
DaVince This fool just HAD to have a custom rating
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.
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