Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Troubleshoot help

edited July 2013 in General Posts: 3

I am just starting to try and learn codea and I wrote this code and every time I run it it comes up with an error that says
Error :7: attempt to perform arithmetic on global value 'rect_height' if someone could show me where my mistake is and how to find them in the future that would be amazing
I believe the mistake is in this general area

function setup()

rect_width=100
rect_hight=50

p_rect = physics.body(POLYGON,
                    vec2(-rect_width / 2, -rect_height / 2),
                    vec2(-rect_width / 2, rect_height / 2),
                    vec2(rect_width / 2, rect_height / 2),
                    vec2(rect_width / 2, -rect_height / 2)
                    )
p_rect.x = math.random(60,250)
p_rect.y = math.random(60,250)
p_rect.angle=math.random(0,360)
p_rect.gravityScale = 0
p_rect.restitution = 1

Comments

  • Jmv38Jmv38 Mod
    Posts: 3,295

    What about.
    rect_height=50.
    Instead of.
    rect_hight=50.

Sign In or Register to comment.