Inverting a hitbox

33 Views Asked by At

I would like a hitbox for a sprite called "ring" to be inverted in code.org.

"ring" is a thin donut and I would like the hitbox to be inverted so then I can have a different sprite called "ball" to be able to bounce inside it. I have tried ring.setCollider("circle",0,0,-50); using a negative radius for the hitbox, but this does not work. Does anyone know how to do this. If you need more context or elaboration on my question I can try to provide it.

Here is my full code (I just started this and I am not close to done, this is merely testing for a bigger project)

var ball = createSprite(200,200);
ball.setAnimation("ball");
ball.setCollider("circle");
ball.bounciness = 0.7;
ball.setSpeedAndDirection(8,randomNumber(0,359));

var ring = createSprite(200,200);
ring.setAnimation("ring");
ring.scale = 3;
ring.setCollider("circle",0,0,-50);



function draw() {
  background("black");
  ball.velocityY += 3;
  
  
  ball.bounceOff(ring);
  drawSprites();
}
0

There are 0 best solutions below