1

I'm making a Brick Breaker Game using Ursina in python. I've created some entities which work as ball and bar.

bar = Entity(model='quad', color=color.blue, position=(4.5, -10, 0), scale=(3, 0.3), collider='box')

ball = Entity(model='sphere', color=color.red, position=(4.5, -9.5, 0), scale=0.25, collider='sphere')

I want the ball at the upper center of the bar without manually setting the x and y value. Like this:

my_imagination

For this I want the width and height of the bar. How can I get that? I tried bar.width. But it returns 'Entity' object has no attribute 'width'

Lixt
  • 201
  • 4
  • 19
Shahriar
  • 71
  • 1
  • 9

1 Answers1

1

Yes, it is possible. You can use bar.scale_x and bar.scale_y.

For more options you can check https://www.ursinaengine.org/api_reference and see Entity (https://www.ursinaengine.org/api_reference#Entity)

Lixt
  • 201
  • 4
  • 19