The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with lifts
 

Post Reply  Post Oekaki 
 

Posted By Message

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
27th February, 2008 at 16:30:18 -

I'm having some serious problems programming lifts.
The problem is that the character always, despite in whatever manner i code it, gets sunk 1 or more pixels down into the lift.
But that shouldn't be happening.

I use a custom platform engine with fastloops that moves the character and all detectors 1 pixel at a time as long as they don't overlap the lift, I move the lift using regular loops. Are these two manners conflicting in any way?

The lift is moved 1 pixel if the character is not standing on it, the lift + the character are (in the same event) moved 1 pixel if the character is standing on it.

I thought that method would make it so that they are moved simultaneously.
Are there any old examples of this? I still use MMF 1.2 not 1.5 or 2. I have an example from Phizzy made in the old TGF, "Mario platform something", it works perfect there, but not for me! I really don't get it. So if someone has any experience with lifts, by all means.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

nim



Registered
  17/05/2002
Points
  7234
27th February, 2008 at 16:42:08 -

It's hard to tell what the problem is without seeing the source code in some way., but it could be the order of your events. If you're moving the platform up on line 4 and the guy on line 28 (especially after any detector collision events) then there's a chance that he'll sink into the lift.

 
//

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
27th February, 2008 at 17:39:11 -

if he's using fastloops it should be in the same event that hes moving them both. if not then i would suggest doing it.

why not upgrade to mmf 1.5? isn't it be free?

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
28th February, 2008 at 10:14:48 -

If it matters here, some of the lifts in Hasslevania had problems with them until I changed where my "lift code" group of events was located in the event order. Sounds weird, but maybe that would help?

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
28th February, 2008 at 13:51:28 -


Originally Posted by cec¿l
if he's using fastloops it should be in the same event that hes moving them both. if not then i would suggest doing it.

why not upgrade to mmf 1.5? isn't it be free?



MMF 1.0 to 1.2 was free, but MMF 1.5 isn't. That, and you can't buy MMF 1.5 anymore unless it's used. Just get MMF2.

 
http://www.facebook.com/truediamondgame

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
1st March, 2008 at 10:23:39 -

Events will execute in the event editor in a specifically TOP-to-BOTTOM matter. This is dead necessity to understand. This is, however, bypassed by calls to loop objects. When a loop event is called, imagine it as if the "On Loop Trigger X" events you have further down in your code are moved to directly after when you called it, and copy/pasted enough times to satisfy the loop. In essence, this is what it is doing.

After this, actions taken within each event are stored in a direct TOP-to-BOTTOM list of their own in order to run through the read/eval/print of the compiler. So lets take a look at a single frame of gameplay:

(your player is currently 1 pixel above the platform, not overlapping it)
Your code is structured in this order:
+If player =/= Overlapping Lift
=Set Y of Lift up by 1
+If player == Overlapping Life
=Set Y of Life up by 1
=Set Y of Player up by 1


So when this is fed into the system, and it trys to run through the frame, this is what happens:

Frame 1:
Player =/= Overlapping Lift? (TRUE)
so sets Y of lift up by one
THEN IT READS THE NEXT LINE:
Player == Overlapping Lift? (TRUE*) *Now that the lift is 1 pixel higher, it is overlapping the player
So sets Y of lift & player up by one

Frame 1 total: Lift moved up by 2, player moved up by 1.

Frame2:
Player =/= Overlapping Lift? (FALSE)
Player == Overlapping Lift? (TRUE)
so sets Y of lift/player up by one, again

Frame 2 total: Lift moved up by 1, player moved up by 1.


After this point, "Frame 2" keeps repeating, over and over. Since in order for your last event, the "Player == Overlapping Lift?" to be true the player must be stuck at least 1 pixel into the lift, when the entire frame resolves, the player will appear 1 pixel down. Add to this that the frame where you initially *hit* the lift, it should appear to jump by 2 pixels instead of 1.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
5th March, 2008 at 22:06:53 -

Hey guys thanx for all the ideas!
But I am very aware of the event order issue and have tried swapping the event positions to no luck. Pixelthief's thorough run-through of the event is exactly what happens, but the problem must be something else!
My code is:

+Always
= Start loop 0 for one loop

+On loop trigger 0
+Detector is not overlapping lift
=Trigger loop 1 for "Y velocity of Player" loops

+On loop trigger 1
+Detector is not overlapping lift
=Set player Y to Y+1
=Set detector Y to Y+1

That's the fastlooped player movement, events high up in the editor, that should be excecuted first.

+Detector is overlapping lift
=Set Lift Y to Y-1
=Set Player Y to Y-1
=Set Detector Y to Y-1

+Detector is not overlapping lift
=Set Lift Y to Y-1

Those are the lift events, ordinary, not fastloops. These events occur way after the fastloops.

Anyone? It's higly illogical, the Vulcans won't be too happy when I release it.
Actually, no Vulcan should be happy since they don't have/express emotions...
Sarek maybe, but not anyone else...

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image
   

Post Reply



 



Advertisement

Worth A Click