The Daily Click ::. Forums ::. Klik Coding Help ::. Character passes through the edge of the frame even with a obstacle
 

Post Reply  Post Oekaki 
 

Posted By Message

J.C



Registered
  22/03/2013 05:18:14
Points
  118
20th April, 2013 at 20/04/2013 01:20:54 -

I am trying to prevent the player character from passing beyond the frame. Since I am using Clickteam's default platform movement (which I was told never to use, I can see why), the character, while falling, passes through the obstacle and out the barrier.

I tried a few different things like:

If player animation falling is playing,

Facing a direction (left or right)

-5 pixels from window's edge
=

Stop, (set X position +10(for right)/-10(for left))

But it doesn't work. I am quite stumped at this point.

Any ways to fix this?

Thanks

 
n/a

Alonso Martin



Registered
  29/12/2010
Points
  294
20th April, 2013 at 20/04/2013 04:07:56 -

Well, use the Platform Movement Object, it's much better than the default one.

Just do an always event -> set x pos of character to max(-5,min(frame width+5,CurrentXpos)).

 
www.hfalicia.com
www.alonsomartin.mx

J.C



Registered
  22/03/2013 05:18:14
Points
  118
23rd April, 2013 at 23/04/2013 01:25:02 -

Could you post a screenshot of how you input that code? I tried it just now but I did something wrong. I kept getting a syntax error. I'm pretty sure I got it wrong at CurrentXpos

 
n/a

nim



Registered
  17/05/2002
Points
  7234
23rd April, 2013 at 23/04/2013 03:15:24 -

Change "CurrentXpos" to the X coordinate of your player.

i.e.
Delete the word "CurrentXpos"
Click the button "Retrieve value from Object"
Right-click on your Player sprite and
choose "X Position"

Alonso's solution is great, as is his advice to use the Platform Movement Object. Just start using the PMO and forget the Default Platform Movement ever existed.

 
//

J.C



Registered
  22/03/2013 05:18:14
Points
  118
24th April, 2013 at 24/04/2013 05:24:53 -

Just tried to input it again, but I'm still getting a syntax error.

It would be best to post a screenshot 'cause I tried to fix it to no avail.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click