User Tag List

Results 1 to 2 of 2

Thread: Player get stuck in walls, please help. (Solved)

  1. #1
    No Products Registered

    Join Date
    Sep 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Player get stuck in walls, please help. (Solved)

    Hi.
    I did this movement system with Fast Loops and float points (Thanks to N64Mario). But now I have this problem, my player get stuck in walls. I tried like 10 times to fix this but failed. Please help.

    This is my code:

    Always
    - (Player): Set Pos X to Pos X("Player") + Speed X("Player)
    - (Player): Set X position to Pos X("Player")

    Start of Frame
    - (Player): Set Pos X to X("Player")

    Repeat while (Joystick) Moved left
    + NO Repeat while (Joystick) Pressed fire 4
    - (Player): Set Speed X to -0.7

    Repeat while (Joystick) Moved right
    + NO Repeat while (Joystick) Pressed fire 4
    - (Player): Set Speed X to 0.7

    NO Repeat while (Joystick) Moved right
    +NO Repeat while (Joystick) Moved left
    - (Player): Set Speed X to 0

    Speed X ("Player") <> 0
    - Start Loop "Moviendo" 1 times

    On Loop "Moviendo"
    + Speed X ("Player") > 0
    + NO (Player) is overlapping a backdrop
    - (Player): Set Pos X to Pos X("Player") + 1

    On Loop "Moviendo"
    + Speed X ("Player") > 0
    + (Player) is overlapping a backdrop
    - Stop Loop "Movimiento"
    - (Player): Set X position to X("Player")-2
    - (Player): Set Speed X to 0

    On Loop "Moviendo"
    + Speed X ("Player") < 0
    + NO (Player) is overlapping a backdrop
    - (Player): Set Pos X to Pos X("Player") - 1

    On Loop "Moviendo"
    + Speed X ("Player") < 0
    + (Player) is overlapping a backdrop
    - Stop Loop "Movimiento"
    - (Player): Set X position to X("Player")+2
    - (Player): Set Speed X to 0


    The problem I think it could be is that when the player is overlapping a backdrop by the right side, then stops, the player is still overlapping a backdrop, and then when trying to press left, the player won't move because it's overlapping the backdrop. But I don't know how to fix that. I'm out of ideas, please help.


    Thank you so much.

    PS. Is there a way to copy the code like "copy-paste" instead of write it all by looking at the Event List Editor window? He he he

    EDIT: I've solved this, the solution I did was to put 2 vertical detectors, one in the right side and the other in the left side. So when any of them is overlapping a backdrop and the player press Right or Left, the player can move 1.5 pixels so he's not stucked at all =D

  2. #2
    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)

    Re: Player get stuck in walls, please help. (Solved)

    Thanks for sharing your solution. What I tend to do is organize the loops so that I know whether the player is moving left or right on each one, so that if the player is suddenly overlapping a backdrop, it can be moved back and the loop stopped immediately.

Similar Threads

  1. Player bouncing off walls when it's supposed to stop
    By kEwLiO in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 31st March 2013, 05:01 PM
  2. Help with walls
    By Grim in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 29th July 2009, 09:08 PM
  3. Enemies getting stuck in the walls when thrown
    By mobichan in forum File Archive
    Replies: 2
    Last Post: 7th May 2009, 05:08 PM
  4. Mario got stuck!
    By Jacob in forum File Archive
    Replies: 2
    Last Post: 12th December 2007, 03:23 AM
  5. Walls in iso?
    By Horn in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 15th June 2007, 09:04 AM

Posting Permissions

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