User Tag List

Results 1 to 7 of 7

Thread: Odds of a hit?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Odds of a hit?

    I would like to ask for for some help with a game I'm making. I have a computer controlled cannon the fires (cannon ball) back at the players castle,.but it's not very accurate. I have the computer controlled cannon setting it's angle before firing, but I want it to hit it's target randomly. Like the odds of it hitting it's target it 1 out of 5 or whatever..
    I hope I explained this right. Anyone have any ideas?

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Calculate the correct angle to hit the castle and then subtract 5 add random(10). This will give it a random chance between + 5 and - 5 degrees accuracy.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS 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)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,367
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    You could do this in numerous ways. Not knowing how your game works, it is hard to know which method works for you.

    Here is one suggestion:

    Set angle to correctAngle + (random(5)*5)-10
    If the correct angle is 45, this will set the angle to either 35,40,45,50 or 55.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Chris,..Thank you. I give this a shot. Can I ask how this would written out?

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is it side view or top down?

    Does the cannon ball shoot directly straight, or does it fire up into the air and then fall down with gravity?

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Popcorn and Chris,

    Here's the game MFA,.the computer controlled part needs to be changed. This is the part that I'm having trouble with. Cannon 1 (player) Left mouse sets the power of the cannon ball speed and right mouse fires it. The code is a mess with the computer controlled cannon at this point,.so don't laugh. I have changed it since this,.but I don't have the file with me today. I have the other cannon firing by pressing M to set angle and L to fire it right now. If you guys want me to upload the other version,.it will have to wait until tomorrow. But,.you'll see what I'm looking to do with this ,.and if you feel like fixing the other cannon,.it would be appreciated as I would like this to be a playable game and the odds of hitting the other target I just can't get my head around. The graphics are being changed too. Instead of rocks being around the characters,.there will be castles that each hit taken by a cannon ball will destroy a little bit of the castle.

    Thanks guys for taking a look at this.
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Just wanted to say thank you to both you guys. It worked out perfect with you methods after some tweaking.

Similar Threads

  1. Making a Racing Game, and other odds and ends.
    By cchapeton in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 15th July 2010, 11:02 PM
  2. Combat Odds Calculation?
    By mjm800 in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 6th April 2010, 03:43 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
  •