Hit test function won't work on up or down

What Wick Editor Version are you using?
1.19.3

Describe the Problem
What issues are you having in the Wick Editor?

I am trying to get my character to stand on top of a wall. but it keeps falling through the wall.

What have you tried so far?
I’ve watched and downloaded the hit test function tutorial and I can get my chracter rupert to repel off of the left and right side but he goes through the wall on up and down. my code looks like this in the Keydown tab:

if(isKeyDown(‘up’)){
this. y -= 10;
if(this.hitTest(wall)){
this.speed_y+=12;
}
}
if(isKeyDown(‘down’)){
this. y += 10;
if(this.hitTest(wall)){
this.speed_y-=12;
}
}
if(isKeyDown(‘left’)){
this. x -= 10;
if(this.hitTest(wall)){
this.speed_x+=12;
}
}
if(isKeyDown(‘right’)){
this. x += 10;
if(this.hitTest(wall)){
this.speed_x-=12;
}
}

if (key === “up”)
{
this.speed_y -= 10;
}

Do you have a Wick Editor File that we can see? Optional*
I have shared my rupert file so you can see what i mean.

rupert file

Thanks for the help :)

I have deleted the entire Keydown tab, and put the following code into the update tab…

Here is the wick file:
Rupert Control v21-9-2023_20-40-08.wick (463.3 KB)

thank you! I’d like to make more ledges and for my character to stand on or jump to. Do I add onground to objects i want rupert to be able to stand on?

thanks again for your help

Right now it is doing a hitTest with only one wall. You could make an array of walls and do a hitTest against every element. Or just move the hitTest part into the walls and do it against the rupert.

Do a search, There are more than 3 platform engines within these forums. You are free to use them.

great thanks!