Page 1 of 1

The Mag Pi Help - Fish Game

Posted: Tue Sep 04, 2012 11:23 pm
by D.E.L.B.
I get everything apart from these two bits:

Code: Select all

# Make the ball chase Tux
if bx>=tx: bx=bx1
else: bx=bx+1
if by>=ty: by=by1
else: by=by+1
fx=fx4
if fx<=10:
fx=600; fy=random.randint(0,370)
# Collision Detection (Tux & Fish, Tux & Ball)
if fx<=tx+50 and fx>=tx and fy>=ty30
and fy<=ty+70:
toy.play(); fx=600;fy=random.randint(0,370); score +=1
if bx<=tx+40 and bx>=tx40
and by>=ty50
and by<=ty+60:
burp.play(); bx=600; by=15;
lives =
1; tx=280; ty=180
and also this:

Code: Select all

tx=280; ty=180; txd=0; tyd=0
bx=600; by=15
fx=600; fy=random.randint(0,370)
bkcol=[127,212,255]
lives=3; score=0; run = True;
What do the semi colons denote? I'm not sure on the first part I provided though, so if you could go into that in-depth it would be awesome! Thanks.

Re: The Mag Pi Help - Fish Game

Posted: Wed Sep 05, 2012 6:41 am
by BlackJack
@D.E.L.B.: The semicolons separate statements within one line. Think of them as having the same effect as line breaks. The Style Guide for Python Code (PEP 8) discourages the use of semicolons in regular source code.

Re: The Mag Pi Help - Fish Game

Posted: Wed Sep 05, 2012 3:30 pm
by D.E.L.B.
Same, I haven't seen any type of source code that does that ever.

So what about the first part, what does that do?