Copy link to clipboard
Copied
hello guys i hope you are having a great day
i am having problems with my hit Test, when my character reaches the planting spot, collision only activates when he is walking down, and not with the desired object, it should wait for axe anim to triger, a movieclip to make contact with parcela 1 and it would do the action before i bring the axe down and then toon, gets stuck in planting place!!
here piece of code
this.on("tick", contactoparcela1.bind(this));
function contactoparcela1(evt) {
//this.caveman.x ++;
//this.mono1.x += 2
if (arar1 == 0) {
var pt = this.mono1.frente.espada.hacha.target.localToLocal(this.mono1.frente.espada.hacha.target.x,
this.mono1.frente.espada.hacha.target.y, this.parcela1);
if (this.parcela1.hitTest(pt.x, pt.y)) {
//alert("collision")
console.log("germinando");
//this.mono1.gotoAndPlay("hit");
//this.malo1.x += 2;
raiz.parcela1.gotoAndStop("uno");
//this.parcela1.gotoAndStop("uno");
}
}
}
here is running :
enterframe5​
heres source:
https://drstevenbackman.000webhostapp.com/flash/enterframe5.fla
TYVM
Having three tick listeners seems like it could cause problems. You could have one listener and do several hitTest().
When you run into the coin I think it's continuing to add money. Setting something to be invisible won't stop the hitTest() from happening.
Watch the error console while you play the game to see when it starts giving errors.
Copy link to clipboard
Copied
Having three tick listeners seems like it could cause problems. You could have one listener and do several hitTest().
When you run into the coin I think it's continuing to add money. Setting something to be invisible won't stop the hitTest() from happening.
Watch the error console while you play the game to see when it starts giving errors.
Copy link to clipboard
Copied
I put all on one tick, i not worried about the coin for now, i guess i will move its x and y to outside the window, or find the delete movie clip equivalent, i still havent find that great animate tutorial
i put all in one tick, and still have same problem, it would seem that i have like a infinite loop when i hit the ground, but i am not using the loop word
lol
the error the console spits, i believe its about not finding a movie clip, because i have a left, front, and right, movie clips when it turns, and when you play the action its on its event some clips arent there, like if toon is front, i get 2 errors from the side movie clip trying to execute also the action, but i only want to execute the movie clip that is present, so thats why it trigers
I also added a big transparent buton on top of stage for toon action, so if you select axe or mazze, it will execute it.
tyvm for help
Copy link to clipboard
Copied
See how it gets stuck https://www.youtube.com/edit?o=U&video_id=LCNm-pGxtB4
https://www.youtube.com/edit?o=U&video_id=LCNm-pGxtB4
I added move function to another tick, so even worst why would it empty my speed variable, if collision is in another function?!
tyvm
Copy link to clipboard
Copied
It was working ok, with my console statements, where evaluate for the direccion variables wich stores dw for down, up for up, etc. and thats how toon moves and i could see it in the console, so after my colision, i would get and get "console errors on the code
this.uparrow.addEventListener("mouseout", moverout.bind(this));
function moverout() {
//alert(huerta1)
walking = 0;
direccion = ""
console.log(this.direccion); //I TRY THIS WITH OUT ;. WITOUHT THIS, AND IT WOULD STILL ERROR REPORTED.
}
So i had to comment out all my console statements and then it executed fine... but spooky... now i can do my collision, keep walking and keep doing stuff.
Thank you Collin