The Daily Click ::. Forums ::. Klik Coding Help ::. Moving blocks
 

Post Reply  Post Oekaki 
 

Posted By Message

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
10th January, 2008 at 11:58:17 -

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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...

 
Old member (~2004-2007).

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
10th January, 2008 at 15:36:41 -

you could make the block only move after the player has pressed against the block for a certain time.

 
.

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
10th January, 2008 at 16:09:05 -

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.

 
http://www.SilverNova.co.uk


Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
10th January, 2008 at 16:47:36 -

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
10th January, 2008 at 17:19:58 -


Originally Posted by Toxic Avenger
I have managed to to this using detectors


<_<

 
Old member (~2004-2007).

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
10th January, 2008 at 17:34:30 -

Yeah, but thats not really telling us an awful lot Vince to be honest It's like "I made a car with wheels..."

 
http://www.SilverNova.co.uk


Deleted User
10th January, 2008 at 18:05:50 -


Originally Posted by cec¿l
you could make left and right detecters to fix that i s'pose.



 

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
10th January, 2008 at 18:15:54 -

Now I'm confused oh well.

 
http://www.SilverNova.co.uk


erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
11th January, 2008 at 05:27:18 -

Well yea, I guess I could get rid of the left/right-detectors and only have one at the top. I'll try this.

EDIT: It's working OK now, but I'm not entirely satisfied. Check this out --> http://www.box.net/shared/9vvatjvq8c

Image Edited by the Author.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
11th January, 2008 at 07:59:09 -

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

here >> http://www.mediafire.com/?6xnbbm70n2j

 
n/a

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
11th January, 2008 at 10:26:33 -

Im afraid i cant download ur file.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
11th January, 2008 at 17:41:26 -

try this >> http://legendkpr.startlogic.com/files/boxmove.zip

 
n/a

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
12th January, 2008 at 09:03:10 -

Hah, thanks! This looks really nice. I might steal some of this.

 
n/a

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
13th January, 2008 at 08:57:14 -

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...?

Here's a sample, but you probably don't need it. --> http://www.box.net/shared/9vvatjvq8c

Thanks.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
13th January, 2008 at 11:57:19 -

Put the box in an object group and let the group react on stuff. You could use Cecil's system and not use detectors to make things a bit easier.

(Note: I haven't looked at the examples.)

 
Old member (~2004-2007).

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
13th January, 2008 at 12:14:08 -

Aw, thats clever. Anyway, I'm keeping the detectors for now cus I had too much trouble without them.

Thx for help.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click