anonymous
  • anonymous
I need an function(collapsion test) to test if 2 shapes collapsed or not ^^
Mathematics
katieb
  • katieb
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
i tried to do it like that: if Xshape1 == Xshape 2 and if Yshape1==Yshape2 then Collapse = ture else false
anonymous
  • anonymous
failed :(
anonymous
  • anonymous
And it should push back ^^

Looking for something else?

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

More answers

anonymous
  • anonymous
ty :D
amistre64
  • amistre64
if ((imgX1 == imgX2) && (imgY1 == imgY2)) {alert('collapsed')} else {alert('failed')}
amistre64
  • amistre64
alert is just a display function
amistre64
  • amistre64
I usually break it into flags instead of going for the whole boolean
anonymous
  • anonymous
amm kk as i do ^^ so alres gives true to collapsed value ye?
anonymous
  • anonymous
but amistre i tried it too and it didn'T work :(
amistre64
  • amistre64
id have to see the programming to really get an understanding of it...
anonymous
  • anonymous
hmm kk but i have an idea just wait
anonymous
  • anonymous
OK I GOT IT JUST LOOK and a "ve" means and in turkish :( i wrote it turkish because of my agitation sorry :(
anonymous
  • anonymous
just look at these amistre
amistre64
  • amistre64
height and width /2 is center of image good; x and y are plots...
anonymous
  • anonymous
yea..
anonymous
  • anonymous
to you, will it work nice?
amistre64
  • amistre64
still looking it over; when do you want to call the collision? at center points of when edges meet?
anonymous
  • anonymous
i want to call when edges meet
anonymous
  • anonymous
no centers
amistre64
  • amistre64
are they both inmotion? or is one stationary?
anonymous
  • anonymous
yea they are in motion
anonymous
  • anonymous
so that, when they collapse, i want them to push back too
amistre64
  • amistre64
well, push back would be just a negation right? opoosite direction of motion
anonymous
  • anonymous
yea
amistre64
  • amistre64
collision happens regardless of both in motion so its simply breaching the area of the other then...
anonymous
  • anonymous
and it hink that if we have a variable named speed speed should be-0.1 f 60 times per sec yea?
anonymous
  • anonymous
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?
amistre64
  • amistre64
cant say fer sure on speed yet but.... for collision I get: if Cxmin = xb-(hb/2) ; Cxmax = xb+(hb/2)
amistre64
  • amistre64
no 'if' there lol just naming variables
anonymous
  • anonymous
yea its like that
anonymous
  • anonymous
ok kk ^^ i am so unpatinet xp
amistre64
  • amistre64
maybe better to name then Axmin, Aymin, Axmax, Aymax, and such right?
anonymous
  • anonymous
amistre u know i am only 14 years old and I am not in highschool yet xd yea
amistre64
  • amistre64
if (Bxmin <= Axmax AND Bxmin >= Axmin) {then collapse}
amistre64
  • amistre64
im 39 so.... so lets keep it proper :)
anonymous
  • anonymous
:)
anonymous
  • anonymous
well its logical
amistre64
  • amistre64
that would generate a collapse if they are inline along the xaxis
amistre64
  • amistre64
factor in the y axis the same way and it should cover all diretions then
amistre64
  • amistre64
whatever your alogrithm for motion is, reverse it
anonymous
  • anonymous
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!!!!!!!!
angela210793
  • angela210793
OMG!!! u solved tht? O.o
amistre64
  • amistre64
you got it :) maybe an easier way to do it, but I never go that route lol
anonymous
  • anonymous
xd anyway we solved this it hink and tomorrow ill try to program it
amistre64
  • amistre64
good luck :)
amistre64
  • amistre64
name your corners; and when they are between each other or equal to each other, collapse
anonymous
  • anonymous
i wanted this collapsion thest to see if cannonball collapsed with theenemey ship
anonymous
  • anonymous
kk thank you
anonymous
  • anonymous
well i wrote algorithm for pushing back :D its ok now
anonymous
  • anonymous
really good work here

Looking for something else?

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