Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with game
#1
hi every one Smile

I'm trying to make a game , i need help to make the bullet start from the ship

i don't know how to use coords

this is the code

from tkinter import *
import random
import time

WIDTH=600
HEIGHT=400

tk=Tk()
c=Canvas(tk,width=WIDTH,height=HEIGHT)
c.pack()



def ship(a):
    c.create_polygon(a,a/2,a-20,a/2+30,a+20,a/2+30,fill="blue")
    return a


def bullet(i):
    c.create_oval(i,i,i+5,i+5,fill="blue")


#=================== KEYS =====================================
def go_left(event):
    c.move(1,-5,0)
    c.update()

def go_right(event):
    c.move(1,5,0)
    c.update()

def go_up(event):
    c.move(1,0,-5)
    c.update()

def go_down(event):
    c.move(1,0,5)
    c.update()

def spaceKey(event=0):
    c.move(2,0,-100)
    c.update()


ship=ship(300)
bult=bullet(298)

tk.bind("<Left>", go_left)
tk.bind("<Right>", go_right)
tk.bind("<Up>", go_up)
tk.bind("<Down>", go_down)
tk.bind('<space>',spaceKey)


tk.mainloop()
Reply


Messages In This Thread
help with game - by hammza - Oct-30-2017, 04:34 PM
RE: help with game - by heiner55 - Nov-11-2017, 03:24 PM
RE: help with game - by hammza - Nov-11-2017, 03:29 PM
RE: help with game - by heiner55 - Nov-11-2017, 05:25 PM
RE: help with game - by hammza - Nov-12-2017, 12:56 AM
RE: help with game - by heiner55 - Nov-13-2017, 06:13 AM
RE: help with game - by hammza - Nov-13-2017, 09:12 AM
RE: help with game - by metulburr - Nov-13-2017, 01:01 PM
RE: help with game - by heiner55 - Nov-13-2017, 01:46 PM
RE: help with game - by hammza - Nov-13-2017, 07:23 PM
RE: help with game - by Windspar - Nov-13-2017, 05:16 PM
RE: help with game - by metulburr - Nov-13-2017, 08:52 PM
RE: help with game - by Windspar - Nov-13-2017, 09:11 PM
RE: help with game - by heiner55 - Nov-14-2017, 05:56 AM
RE: help with game - by Windspar - Nov-14-2017, 02:06 PM
RE: help with game - by Windspar - Nov-14-2017, 08:40 PM
RE: help with game - by metulburr - Nov-14-2017, 09:23 PM
RE: help with game - by hammza - Dec-06-2017, 02:37 PM
RE: help with game - by Windspar - Nov-14-2017, 10:15 PM
RE: help with game - by Windspar - Nov-18-2017, 02:50 AM
RE: help with game - by hammza - Dec-06-2017, 01:13 PM
RE: help with game - by Windspar - Dec-06-2017, 02:47 PM
RE: help with game - by hammza - Dec-07-2017, 01:07 AM
RE: help with game - by Windspar - Dec-07-2017, 03:37 AM
RE: help with game - by hammza - Dec-07-2017, 06:00 AM
RE: help with game - by Windspar - Dec-07-2017, 03:48 PM
RE: help with game - by hammza - Dec-07-2017, 05:30 PM
RE: help with game - by Windspar - Dec-07-2017, 09:24 PM
RE: help with game - by hammza - Dec-08-2017, 02:10 AM
RE: help with game - by Windspar - Dec-08-2017, 02:44 AM
RE: help with game - by hammza - Dec-08-2017, 12:45 PM
RE: help with game - by Windspar - Dec-08-2017, 01:37 PM
RE: help with game - by hammza - Dec-08-2017, 03:09 PM
RE: help with game - by Windspar - Dec-08-2017, 03:17 PM
RE: help with game - by hammza - Dec-08-2017, 03:22 PM
RE: help with game - by Windspar - Dec-08-2017, 03:28 PM
RE: help with game - by hammza - Dec-08-2017, 03:30 PM
RE: help with game - by Windspar - Dec-08-2017, 03:39 PM
RE: help with game - by Windspar - Dec-08-2017, 11:17 PM
RE: help with game - by hammza - Dec-09-2017, 01:05 AM
RE: help with game - by Windspar - Dec-09-2017, 01:19 AM
RE: help with game - by hammza - Dec-09-2017, 01:25 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020