Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
why won't my circle move the hardcoded value of 4 i set for roll?

What I have tried:

import random
from graphics import *

window = GraphWin("gameWindow", 1000, 1000)
myImage = Image(Point(400,400), "Yun.gif")
myImage.draw(window)

c = Circle(Point(50,50), 10)
c.draw(window)
    
class Piece(object):
    def moveTo(c):
        oldPos=c.getCenter()
        oldX, oldY = oldPos.getX(), oldPos.getY()
        roll = 4
        newX, newY = oldPos.getX()+roll, oldPos.getY()+roll
        moveX = newX - oldX
        moveY = newY - oldY
        c.move(moveX, moveY)
        

def main():
    move = Piece()
    move.moveTo()
    c.moveTo()
    print "yay"
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900