Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411516 Posts in 69380 Topics- by 58436 Members - Latest Member: GlitchyPSI

May 01, 2024, 06:19:37 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)FLIXEL: Making an element ignore scrolling while retaining hitbox.
Pages: [1]
Print
Author Topic: FLIXEL: Making an element ignore scrolling while retaining hitbox.  (Read 1614 times)
A_Rival
Level 0
*


View Profile
« on: July 27, 2010, 02:09:30 PM »

Hey there,

I've created a multilayered tiled background which scrolls vertically.  I want to have a platform at the very bottom of the screen which doesn't move, which is about 10 tiles wide and 1 tile high. I can set that particular TileMap's scrollfactor.y to 0, but the actual hitbox seems to keep scrolling while the graphics don't.

I tried to move up the platform in update() the exact amount it scrolled, but the collision gets super finicky and the graphics jiggle around.

Is there a better way to do this?

-A
Logged
Melly
Level 10
*****


This is how being from "da hood" is like, right?


View Profile
« Reply #1 on: July 27, 2010, 05:06:06 PM »

scrollFactor, in general, is mostly useful for graphical stuff. If you want things to be affected by scrollFactor and collide, then yeah, things get a bit more complicated, and you should probably code the solution yourself, most probably without using scrollFactor (but maybe reading from the related values in FlxG to control the platform's movement).

Honestly, I would just drop scrollFactor for that platform entirely and move it manually by the scroll values. The finicky collision and graphic problems can probably be fixed by placing the movement code before or after the right update() call. It's probably gonna take a bit of fooling around.

That's all in my experience at least.
Logged

Feel free to disregard the above.
Games: Minus / Action Escape Kitty
A_Rival
Level 0
*


View Profile
« Reply #2 on: July 29, 2010, 10:44:20 AM »

Thanks for your reply!  Was pretty much the exact kind of reply I was looking for.

I'm also working on trying to make downward moving platforms as though the entire stage is moving downward.  It's sort of like and endless elevator.

Any advice?  I'm just gonna rough it but some pitfalls to look out for are always appreciated.

-A
Logged
bart_the_13th
Level 2
**


View Profile
« Reply #3 on: July 30, 2010, 01:09:08 AM »

How about , instead of having the scrolling stuff, you make the platforms move upward, thus creating an illusion that the player is falling down?
Logged
A_Rival
Level 0
*


View Profile
« Reply #4 on: July 30, 2010, 02:10:58 PM »

@bart_the_13th: that's basically what Melly just said. Tongue  But definitely it's the preferred method.  Flixel treats platforms moving downward as if they were scrolling anyway, so my entire problem is fixed.  Thanks!

-A
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic