/
Forside
/
Teknologi
/
Multimedie & design
/
Flash
/
Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn
*
Kodeord
*
Husk mig
Brugerservice
Kom godt i gang
Bliv medlem
Seneste indlæg
Find en bruger
Stil et spørgsmål
Skriv et tip
Fortæl en ven
Pointsystemet
Kontakt Kandu.dk
Emnevisning
Kategorier
Alfabetisk
Karriere
Interesser
Teknologi
Reklame
Top 10 brugere
Flash
#
Navn
Point
1
bentjuul
4251
2
molokyle
1978
3
Klaudi
1488
4
jhvp
1265
5
pallenoc
1160
6
katekismus
1020
7
Fnollerpi..
790
8
slander
510
9
Dr.Disco
500
10
Flash77
500
collision detection in Flash
Fra :
Ben Haldenby
Dato :
10-04-01 15:04
Hello everyone,
This is my first posting to this group so I apologise if this issue has come
up before. I'm developing a simple game and using hitTest to detect when two
movie clips collide. Let me explain...
My first movie clip is a 'cricket ball' with a 15 frame tweened animation of
the ball disappearing into the distance (kind of simulating a throwing
motion) This is done with a motion path. On the first frame of this movie
clip I have the following script:
stop()
Mouse.hide();
startDrag (theball, true);
So this hides the cursor and makes the ball instance follow the mouse. Back
on the main stage I have this script attached to the ball movie clip itself:
onClipEvent (mouseDown) {
tellTarget (theball) {
play ();
stopDrag ();
}
}
So on mouse down this plays the movie clip (the throwing action) and stops
dragging. The movie clip then loops when it reaches frame 15 and we are back
at the start. Here comes the tricky bit. The second movie clip is a square
with two frames, the first tells the movie to
stop(); and the second adds an explosion to the square and goes back to
frame 1. I want the final frame of my ball movie to carry the
collision/hitTest script, but it doesn't work:
onClipEvent (enterFrame) {
if (this.hitTest(_root.streaker ) == true) {
tellTarget (_root.streaker) {
gotoAndPlay(2);
}
}
}
I can make it work if the ball instance carries the hiTest script, but thats
means the collision is detected always and I only want it to occur when the
ball 'hits the target'. I hope this is all clear and that someone can help
me, I'm pulling my hair out.
Thanks in anticipation,
Ben
Søg
Alle emner
Teknologi
Multimedie & design
Flash
Indstillinger
Spørgsmål
Tips
Usenet
Reklame
Statistik
Spørgsmål :
177552
Tips :
31968
Nyheder :
719565
Indlæg :
6408847
Brugere :
218887
Månedens bedste
Årets bedste
Sidste års bedste
Copyright © 2000-2024 kandu.dk. Alle rettigheder forbeholdes.