I’m Curently Making a game for the wick editor game jam and there’s gonna be a mini obstical course that has solid objects, i dont know how to code a collision,
Can someone send me the code for collision?
you can use if(hitTest)
i think this is in the object tab. idk. (i mean “hitTest” is in the object tab of the reference)
if(a.hitTest(b)) {
// code
}
i also need help on making a controllable character
yeah i know i mean how to make it jump n stuff
here’s some simple gravity (put this in update):
this.y += 5;
A simple jump (put this in keypressed);
this.y -= 10;
you can find a controllable character in the presets
where do i put it in?
put it in update
still didnt work
what code do i put on the //put code here
i wasn’t gonna expect a and b to work, i expected that you knew to replace them with the correct things. the // put code here
is for you to put the collision code. i’m not gonna know exactly what you want in your code, so that’s for you to fill out. if you want a really basic collision, set the ball’s y position to be on top of the ground. i’m sure you will know what to do.
if you want a more complex collision, that’ll take too long for me to remember and retype. you can use either my platformer engine or pumpkinhead’s for that.
That’s because in Wick Editor 1.19, it’s not a test anymore, it’s just hit (it used to be hitTest)
If your using wick editor 1.19, it’s prefered to use hits
if(this.hits(that)){
//something
}
The hitTest STILL works in 1.19
wait, but deprecate means disapprove of. unless there’s a different definition that means “removed” or “discontinued” or something like that. @Luxapodular i need you to give me an English lesson, what does deprecate mean in this case? (before anyone tells me to search it up, i already did. that’s the definition in the first sentence.)
usually deprecated means that this thing is like superseded by a new thing but it’s still there for backwards compatibility
Yeppo, @pumpkinhead’s got it. Basically, hitTest() is still there, however in 1.19 and onwards we recommend using .hits(), and no bugs with hitTest() will be fixed.
the .hits() function should work identically with hitTest in the most basic case:
if (this.hits(that)) { }
But, now you get a number of new options and performance improvements
1.19 is slightly delayed due to a potential bug with update, but is available on test.wickeditor.com
i’ve tried youre code and when i tested it with a controllible character it didnt work