User Tag List

Results 1 to 10 of 10

Thread: Player Lives not working correctly & bullets not lining up with player's ship.

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Player Lives not working correctly & bullets not lining up with player's ship.

    Hi Guys

    I made my first game with CF 2.5, a clone of the Atari arcade game Asteroids and I'm having some minor issues that I just can't seem to work out.

    1st issue is that when my player gets killed, for the first time in the game, 2 lives are subtracted from number of lives. each time after that it works as intended by subtracting 1 life.
    2nd issue, the player bullets, when fired, are not lining up with the front of the space ship. I think I have the action points for the ship correct, but, most of the time the bullet is just not lining up where it should.


    This is a link to my game, I'm hoping someone can take a look at it & tell me what I may have done wrong. This is my 1st game, so, I have a lot to learn.

    https://www.dropbox.com/s/dfr3bwi7cy...roids.zip?dl=0

    Thanks for your time.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hey DarkProgrammer,

    One of ways to fix the life-related bug and to give yourself an easier time is to streamline a sequence of related actions into one fastloop.

    For example, you have it when the "Player_StarFighter" collides with a specific object, the following happens:

    • the specific object is destroyed
    • A life is lost/subtracted
    • The "Explosion" sample plays
    • An "Explosion_Object" is created on the player
    • The "Player_StarFighter" is destroyed
    • The "Player_Respawn_Timer" is set to a specified value (300)


    The bottom 5 actions (bolded) could be grouped into one fastloop. Whenever this fastloop is ran, the program immediately performs the set of actions under the fastloop. This lets you program any series of actions once rather than multiple times.

    Here is what the events look like streamlined with fastloops.



    Furthermore, events 20 - 22 could be consolidated into 1 event by putting the "Asteroid", "Enemy_UFO_Bullet", and "Enemy_UFO" into the Obstacle Qualifier; as shown below.



    This effectively states that if the Player collides with any object which is tagged as an "Obstacle", that object is destroyed and the "lose_life" fastloop runs.



    Why Does this Happen?

    This happens because there are actually 2 "Player_Starfigher objects created initially. One is created during edittime. The other is created from event 25

    This event is true at the start of the frame so one instance of the object is created right on the first instance. You can correct this by adding a "Number of 'Player_StarFighter' objects = 0" to the condition as shown below.




    Summary

    The only thing wrong was event 25. However you can make your code cleaner and give yourself an easier time by consolidating those "Collision between 'Player_StarFighter' and 'Object X' " into fastloops and qualifiers.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow ProdigyX,

    Thank you so much for giving me those details. I have corrected step 25, as you have shown, & the player lives are working correctly now. I'm also going to modify the other steps in the game which you pointed out would make my code more efficient and cleaner.

    I'm still trying to figure out why the player bullets are not lining up with the front of the ship. I know it must have to do with the action points, would you have any insight on that too?

    Thank you again.

    Dark

  4. #4
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Being that I'm a beginner, I'm having trouble creating a "Fast Loop" is there a good tutorial available on the topic? sorry for being so noobish.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yeah, you can search of the forums about "Fastloops" or "Immediate Conditions".

    You could also try checking out this fastloop tutorial link. Though this goes over immediate conditions in general, I think it might have what you'll want to know about fastloops.

    Creating Fast Loop

    Fastloops are found under the "Special Conditions Object." You execute the loop with the "Start loop" action.



    After you call a loop, you need to use the "On Loop" condition within the "Special Conditions Object" execute actions under the loop.


  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module

    Join Date
    Jun 2012
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't want to undermine what Prodigy said BUT in this case adding fastloops might make things more complicated than they need to be, especially for someone who is new to this stuff.

    How to fix the lives problem: Add the condition "only one action when event loops" to each of your death scenarios and it will fix the problem. It fixed it for me.

    How to fix the ship alignment: The reason why it appears that the bullet isn't aligned is because you have only 8 directional animations for your ship but the game is still calculating a full range of motion when determining where the bullet will emerge. In other words, your ship is technically "turned" enough to fire a bullet at a slant, however it isn't turned enough to switch to the next directional animation. Change the number of directional animations to the max and it will give a much more accurate depiction.

  7. #7
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to you all for responding. I'm going to read the tutorial on Fastloops & hopefully get a better understanding of them, I'm also going to examine my animations on the ship. I really appreciate the fast responses to my questions!

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module

    Join Date
    Jun 2012
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the animation editor, look under the 8 direction indicator that contains the ship animations. There is a slider that you can drag left and right. Drag it all the way to the right to maximize directional slots for animations, then right click one of the ship animations and tell it to create rotated animations for all empty slots.

  9. #9
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ProdigyX, did you modify my original file to create the screen shots in your post? If you did can you send it to me so I can look at the changes? Thanks!

  10. #10
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    animdude, your suggestion worked perfectly, Thank you a lot.

Similar Threads

  1. Any way to let one player send a text file to another player?
    By BrashMonkey in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 23rd January 2013, 06:56 PM
  2. Player 2 Walks from Player 1
    By Radoslaw in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 3rd September 2011, 06:02 PM
  3. Player 2 Walks from Player 1
    By Radoslaw in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 2nd September 2011, 03:44 PM
  4. Player moves with ship Problem.
    By Worf in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 7th January 2010, 08:56 AM
  5. player/lives
    By Taco in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 29th August 2007, 04:29 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
  •