User Tag List

Results 1 to 1 of 1

Thread: Converting code for projectile into fastloop code for proper collision detection

  1. #1
    Clicker Fusion 2.5

    Join Date
    Feb 2014
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting code for projectile into fastloop code for proper collision detection

    Hi there. So uh, I'm trying to make a projectile that when it hits a wall will travel along that wall and eventually disappear. There's plenty of examples of projectiles, and plenty of examples of objects that will travel along walls. I did some tweaking of my own to an example for 360 degree firing so that after traveling a short distance the projectile path will begin to curve downwards. That all works fine. Bullet launches, bullet hits walls and stops, bullet travels along walls. All nice and good.

    Problem I'm facing is that the bullet stops too late most of the time, or too early other times. This leaves the object that will travel along the wall unable to do so because it's either too deep or floating. I've tried a few techniques to prevent this, such as getting its X and Y when it's not overlapping an object and moving it there when it does, or attempting to pull backwards on its traveled path when it's inside a wall, but no luck. I've also tried running the code in a fastloop and a foreach loop, as I'll get into in a sec, but I guess I set it up wrong because they didn't do anything different.

    When things are at just the right angle and distance then yeah, the projectile stops where it needs to and the object created will travel along the backdrop. Works fine. But that's only in the perfect scenario. I need to be able to just launch the projectile and it behave properly. I figure a proper fastloop would give me perfect collision detection, however I'm not sure how I would implement it in the current setup I have. I really like how I can make projectiles have a bullet drop mechanic and accurately rotate to match its path, and I'm afraid I'd lose that if I go into a fastloop system. Obviously if I knew what I was doing I wouldn't, but that's why I'm here.

    How would I implement this system into a fastloop (or really a foreach loop would probably be better so I can fire multiple projectiles and have them all behave properly and independently) so I can have proper collision detection?

    Just as a heads up, the projectile itself can be as simple and static as needed. It's just a mask. The projectile the player will actually see will exist on another layer. However, if a major rewrite is needed to get this collision detection working, I would like to also have a heads up on how I can get that mask to properly rotate based on the trajectory of the mask. Right now in the actual game it just sort of mimics what the mask is doing, but if the mask behaves differently then I still need the projectile to properly follow the mask and rotate to its traveling direction (and not like an 8 direction rotation. That might look a little weird depending on the angle it's moving).

    Here is a link to an example .mfa I set up. Arrow keys move and select the direction you fire in, space shoots. Any help would be greatly appreciated, thank you.
    Attached files Attached files

Similar Threads

  1. Many lines of code = issues with code firing in order?
    By GamesterX23 in forum Fusion 2.5
    Replies: 4
    Last Post: 5th July 2015, 07:31 PM
  2. Converting VB Script to MMF2 COM Object code
    By crayzorechos in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 15th June 2013, 12:17 AM
  3. 8 direction fastloop movement + collision example
    By Konidias in forum File Archive
    Replies: 0
    Last Post: 26th December 2010, 07:44 PM
  4. V-Code Generator Source Code
    By LB in forum File Archive
    Replies: 1
    Last Post: 10th March 2008, 08:52 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
  •