User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Determining which side of platform Player collides with

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Determining which side of platform Player collides with

    This is a platform game

    I have a player object ( blue square ) which moves along the x ( left/ right movement ) and y ( gravity/ jumps ) axis ( image below )
    I also have a platform object ( black square ) which the Player should interact with, like a solid box ( image below )

    ---
    My event editor should looks like this, with collition detection before objects move ( for specific reasons i wont get intoo now )

    If Player overlaps Platform
    - *reposition Player
    Allways --->
    - Player move X
    - Player move Y
    ----
    What i cant grasp is how i can determine when Player is colliding with the topside og the Platform ( image below )

    and when Player is colliding with the left side of the Platform ( image below )

    ---
    Any sugestions or ideas on how to tackle this would help alot

  2. #2
    Clicker Multimedia Fusion 2Android Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Android Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Dec 2010
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hell man... I was thinking about this the other day, and didnt come to a conclusion . _.'

    Maybe, just maybe, you could make so that the platoform has 32 directions, (not visual only virtual), and determine witch direction will stop the player or not. Of corse, se it to "look always" to player.

    Got it? if not I can send an example soon. (too busy right now)

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Intersting idea, I think i understand your consept
    It would be cool if you could make an example

    I still welcome other suggestions and ideas

  4. #4
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My method for doing platform games is slightly different, but the general theory I use for this is to separate horizontal and vertical movement into different events rather than having them both in one "always". That way, you know whether a player is moving vertically or horizontally, because you're only dealing with events that handle one axis at a time.

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You need to create detectors. Detectors are invisible active objects (usually just a thin line, 1 or 2 pixel thick) on each side of your player. Always set their X and Y to that of the player. Then you can just test if "Right Dectector" is overlapping backdrop. It is pretty easy to figure out but I can make an example if you need it. Good luck!

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On the contrary, you don't need detectors at all. I like to move the player around a bit and store the data in Alterable Values. Create four values, labeled Overlap Left, Overlap Up, Overlap Right, and Overlap Down. Then in your events, do

    Always:
    ->Set Overlap Left to 0
    ->Set Overlap Up to 0
    ->Set Overlap Right to 0
    ->Set Overlap Down to 0
    ->Set X to X-1

    Object is overlapping Backdrop:
    ->Set Overlap Left to 1

    Always:
    ->Set X to X+1
    ->Set Y to Y-1

    Object is overlapping Backdrop:
    ->Set Overlap Up to 1

    Always:
    ->Set Y to Y+1
    ->Set X to X+1

    Object is overlapping Backdrop:
    ->Set Overlap Right to 1

    Always:
    ->Set X to X-1
    ->Set Y to Y+1

    Object is overlapping backdrop:
    ->Set Overlap Down to 1

    Always:
    ->Set Y to Y-1

    As you can see, it basically moves the object in a circle, first checking the left, the top, the right, and then finally the bottom. The last event will put it back to the center. All of the positional events cancel out before the end of the event cycle, so you don't see any movement at all. Then, when you're right up against an object, you can see from the Overlap values what side you are colliding on. This is the fundamental aspect of all movements, whether platform, iso, 8dir, etc. You need to know where obstacles are in relation to the player. You can do it this way, or use detectors, or use fastloops, or even a separate object that tells you where the obstacles are (such as surface, an active, or an array). There are probably more ways, but once you have this, you can make any movement you want with little effort.

  7. #7
    Clicker Multimedia Fusion 2Android Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Android Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Dec 2010
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have been avoiding detectors, since platform movement object is so effective...

    King, I am kind in a rush right now, I may do your example soon, if you still need it.

  8. #8
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all, thanks for all the ideas and suggestions people!
    ...
    ChrisBurrows
    I know i dont need to use detectors to make a platform movement work. I thought i needed them but have later realized it was perfectly possible with just a collition mask ( like the blue box in the image in original post ). And also seeing that im working on this platform movement to work for both Player and Enemy object, adding 1 - 4 detector object to every Enemy in a Level with lets say 25 enemys would be overkill imo ( resulting in 25 - 100 extra objects ).
    ...
    Jacob
    Indeed it is importaint to know where Obstacles are in relation to the Player. The example you gave above will do exactly this "when you're right up against an object" as you say yourself.
    In my case however ( example first post ), moving my object around in acircle like in your example dont answer the question "is Player colliding with Left or Right side of Platform?".

    Im not exactly sure about the code, and i know they are two different softwares which work in different ways, but i remeber a command in GameMaker wich could be applied to an object with speed and direction. The comand was called moveToContact i think, and moved the object in the direction untill its possition was right up against a Solid ( platform ) object.
    Know its wishfull thinking, but i could need something like this right now.
    ...
    DavidN
    I am familiar with your method of doing platform movement and have done it this way many times myself. However i am beginning to become more and more of a perfectioninst and freak for details, and so i see the the flaws of my old ways of doing things and want to perfect them.

    This is an illustration of a Player object ( blue box ) moving at a constant speed in the right direction and at an icreasing speed downwards ( simulating gravity )

    The Player clearly never overlaps any of the Obstacles ( black boxes ) along its movement path


    What happens when treating X and Y movement and collitions seperate in the same example i illustrate below

    As you see here the Player overlaps both Obstacles at Positions A and B when it realy should not, judging from the curved trajectory in the first illustration ( Hot Spot of Player located at bottom center in both illustrations )
    ...
    EdibleWare
    Thats OK if you dont have time
    I have been thinking about your idea a bit and am having troubble believing a single diection check ( alone ) between Platforms possition and Players position ( it being the Players current overlaped possition or possition prior to overlap ) would result in detecting which side of Platform the collition occures ( seeing that x and y movement are variable )
    ...
    I do have some half baked ideas on how to handle this issue myself, but they all seem overly complicated and im beginning to think im way too worried about detailes like this.
    Is this realy that big of an issue? Am I exaggerating the problem? I hate to give up, though i could just go for one of the simpler but less precise solutions and move on

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should look into the Ball Bounce widget I posted here. It calculates the target position and then interpolates towards it, detecting collisions on every side. I'm sure it can be modified into a platform widget or anything else you need it to be.

    However, I wouldn't worry too much about what you describe. Of course you're right about that sometime the player will collide with a wall in a few situations when it's not desireable, but unless you're working with really high speeds, it doesn't tend to cause any problems.

  10. #10
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I usually use detectors, but they do require a lot of extra objects so I guess they aren't the best option.

    I would definitely use Jacob's method if you want to avoid detectors though. It actually does answer the question you asked about colliding with the left or right side of a platform. The alterable values he declared called Overlap up, left, down, and right determine which sides of your object are colliding with an obstacle. Basically, every frame your object is moved 'in a circle' (one pixel in each of the four main directions) and sets a corresponding value if your object overlapped an obstacle after moving in that direction. The movement is instant so you don't actually see what's happening, but after the loop is done you'll know what side any obstacles are on. It's kind of difficult to explain but it does work.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Move player while he's on a moving platform?
    By BartekB in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th November 2013, 04:25 PM
  2. Bug in drag and drop system when collides?
    By paobrasil in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 5th September 2012, 12:12 AM
  3. Moving Platform doesn't seem to like Player (^-^;)
    By Raylax in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 15th February 2009, 09:23 PM
  4. Platform game - set player's angle
    By salamander in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 15th September 2008, 05:04 AM
  5. Pls help with collides with backdrop problem
    By Jaeu in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 3rd August 2006, 11:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •