python - Why isn't my variable in a list behaving the way I expect it to? -


I am trying to create a simple animation in Python using a python that runs on a block screen. I am involved in the relevant parts of the code (what do I think).

  x, y = 1, 1 while true: rwidth, rheight = 10, 10 left, top = x - (ravith / 2), y - (rheight / 2) myRect = left, Up, rwd, right pagam Draw (Screen, white, myrrct) position = [x, y] speed = [5, 5] position [0] + = velocity [0]  

what is the block , Where it is supposed to be, but it does not move. However, if I change the position with [0] + = velocity [0] with x + = velocity [0] , then it does what I want. What I think, the situation [0] and x should mean the same thing, why is not it working?

This is due to the fact that you are using values ​​ X and y to draw the block and not the position [0] or position [1] . When you are updating the status values, the variables remain x and y (see your code). Therefore, for the time the status does not serve any purpose in your program, except that it is the x and y value group.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -