The Daily Click ::. Forums ::. Klik Coding Help ::. noob question with the platform movement object
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
23rd June, 2014 at 23/06/2014 04:27:01 -

so... it seems that i have forgotten how to do this... dont know why... but anyway, when walking into an obstacle like a wall, how do i keep the characters animation from spazzing out and rapidly switching between the first frame of the walking animation and the standing animation while the character is not moving? again, im using the platform movement object. i know its something simple, i just have not done it in quite a while.

 
[Game design makes my brain feel like its gonna explode.]

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
23rd June, 2014 at 23/06/2014 10:17:55 -

Not sure I'm aware of a "simple" solution, though what I do is have an active object detector on either side of the player object. I disable right movement when the right detector overlaps a wall. The same thing for the left. This has worked well for me. It's not difficult, just a bit of a workaround.

 
Image

Tell 'em Babs is 'ere...

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
23rd June, 2014 at 23/06/2014 20:45:23 -

Works for me lol. ill be able to easily incorporate that into my game celestia, as it already has those detectors used for wall jumping and such, guess ill just add them to this new project as well.

 
[Game design makes my brain feel like its gonna explode.]

LordHannu

Crazy?

Registered
  22/04/2007
Points
  7909

VIP MemberStarTeddy BearRibbonGame of the Week Winner2021 Halloween Competition Winner2022 Hi-Score Mash-up Competition (Bronze)2023 Halloween Competition (Bronze)2023 Halloween Competition Entrant
29th June, 2014 at 29/06/2014 00:56:41 -

You make one collition-box. That is the player. and paste the animation ontop of it and hide the box,

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
14th July, 2014 at 14/07/2014 21:38:27 -

thats what i do lordhannu, but when walking into a wall the character twitches and freaks out

 
[Game design makes my brain feel like its gonna explode.]

The_Antisony

At least I'm not Circy

Registered
  01/07/2002
Points
  1341

VIP MemberStarSnow
20th July, 2014 at 20/07/2014 19:46:46 -

Well, this is kinda cheater mode; but you can fix the animation problem by testing for a higher base speed value on your detector active. Still won't keep the active from 'bouncing' off of obstacles, but it does keep the overlayed player active from wigging out and looping between stopped and walking animations.

Always:
Change animation direction(Player_Active) to Dir(Detector_Active)
Set position(Player_Active) at 0,0 from (Detector_Active)
(Player_Active) Bring to front.

Speed of (Detector_Active) > 15
+Only one action when event loops:
(Player_Active) change animation to Walking.

Speed of (Detector_Active) <= 15:
(Player_Active) change animation to Stopped.

(Detector_Active) collides with Background:
(Detector_Active) stop.



Now, to do the same with PMO, I guess we're testing for xvelocity instead of speed.
I add two extra events that test xvelocity within both a positive and negative range to differentiate between moving left versus right.
Oh, also... this will work with the default options of PMO, but if you've changed settings, you may either need to increase or decrease the xvelocity test range (from 0-100).

Start of Frame:
(PMO) set object (Detector_Active)

Always:
Change animation direction(Player_Active) to Dir(Detector_Active)
Set position(Player_Active) at 0,0 from (Detector_Active)
(Player_Active) Bring to front.

GetXVelocity(PMO) > 100
+Only one action when event loops:
(Player_Active) Change animation sequence to walking.

GetXVelocity(PMO) > 0
+GetXVelocity(PMO) <= 100:
(Player_Active) Change animation sequence to stopped.

GetXVelocity(PMO) < -100
+only one action when event loops:
(Player_Active) Change animation sequence to walking.

GetXVelocity(PMO) < 0
+GetXVelocity(PMO) >= -100:
(Player_Active) Change animation sequence to stopped.

(PMO) Test obstacle overlap
+(Detector_Active) Collides with the background:
(PMO) Selected object overlaps an obstacle.

Repeat while Left Arrow is pressed:
(PMO) User is holding left input key.

Repeat while Right Arrow is pressed:
(PMO) User is holding right input key.


Edited by The_Antisony

 
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?
   

Post Reply



 



Advertisement

Worth A Click