A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

I need an function(collapsion test) to test if 2 shapes collapsed or not ^^

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i tried to do it like that: if Xshape1 == Xshape 2 and if Yshape1==Yshape2 then Collapse = ture else false

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    failed :(

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    And it should push back ^^

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ty :D

  5. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    if ((imgX1 == imgX2) && (imgY1 == imgY2)) {alert('collapsed')} else {alert('failed')}

  6. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    alert is just a display function

  7. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    I usually break it into flags instead of going for the whole boolean

  8. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    amm kk as i do ^^ so alres gives true to collapsed value ye?

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    but amistre i tried it too and it didn'T work :(

  10. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    id have to see the programming to really get an understanding of it...

  11. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    hmm kk but i have an idea just wait

  12. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    OK I GOT IT JUST LOOK and a "ve" means and in turkish :( i wrote it turkish because of my agitation sorry :(

  13. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    just look at these amistre

  14. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    height and width /2 is center of image good; x and y are plots...

  15. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yea..

  16. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    to you, will it work nice?

  17. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    still looking it over; when do you want to call the collision? at center points of when edges meet?

  18. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i want to call when edges meet

  19. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    no centers

  20. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    are they both inmotion? or is one stationary?

  21. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yea they are in motion

  22. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so that, when they collapse, i want them to push back too

  23. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    well, push back would be just a negation right? opoosite direction of motion

  24. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yea

  25. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    collision happens regardless of both in motion so its simply breaching the area of the other then...

  26. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and it hink that if we have a variable named speed speed should be-0.1 f 60 times per sec yea?

  27. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    u right , so when it collapese if it moves on X+1 direction it will move in X-1 direction and speed -0.1f 60 times per sec and if speed < 0 the it should stop ya?

  28. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    cant say fer sure on speed yet but.... for collision I get: if Cxmin = xb-(hb/2) ; Cxmax = xb+(hb/2)

  29. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    no 'if' there lol just naming variables

  30. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yea its like that

  31. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok kk ^^ i am so unpatinet xp

  32. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    maybe better to name then Axmin, Aymin, Axmax, Aymax, and such right?

  33. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    amistre u know i am only 14 years old and I am not in highschool yet xd yea

  34. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    if (Bxmin <= Axmax AND Bxmin >= Axmin) {then collapse}

  35. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    im 39 so.... so lets keep it proper :)

  36. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    :)

  37. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    well its logical

  38. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    that would generate a collapse if they are inline along the xaxis

  39. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    factor in the y axis the same way and it should cover all diretions then

  40. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    whatever your alogrithm for motion is, reverse it

  41. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and t then do same thing for y axis and put them if if (Bxmin <= Axmax AND Bxmin >= Axmin) {then collapsex=ture} and for the other equatin is ture then collapsey=ture and if collapsex==ture and collapsey== ture then collapse==True!!!!!!!!

  42. angela210793
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    OMG!!! u solved tht? O.o

  43. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    you got it :) maybe an easier way to do it, but I never go that route lol

  44. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    xd anyway we solved this it hink and tomorrow ill try to program it

  45. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    good luck :)

  46. amistre64
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    name your corners; and when they are between each other or equal to each other, collapse

  47. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i wanted this collapsion thest to see if cannonball collapsed with theenemey ship

  48. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    kk thank you

  49. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    well i wrote algorithm for pushing back :D its ok now

  50. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    really good work here

  51. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.