Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Using classes for room movement (text game)
Post: RE: Using classes for room movement (text game)

(Aug-19-2019, 07:02 PM)nilamo Wrote: Alright, so let me restructure your question, to make sure I understand it right. Given this code:class Room: def __init__(self, x, y): self.x = x ...
Lawr3y Game Development 3 6,574 Aug-20-2019, 12:40 AM
    Thread: Using classes for room movement (text game)
Post: Using classes for room movement (text game)

Hello again. This time, I'm using a class to define different rooms, but am having trouble moving between them whenever I run the program: class Rooms: def __init__(self, name, desc, co_x, co_y, ...
Lawr3y Game Development 3 6,574 Aug-19-2019, 06:36 PM
    Thread: Printing class results returns 'none'
Post: RE: Printing class results returns 'none'

(Aug-16-2019, 01:57 PM)ThomasL Wrote: def getStats(self): print(self.strength, self.dexterity, self.wisdom, self.intelligence)It´s a bad idea to use print() to print class values in a cl...
Lawr3y Game Development 5 4,740 Aug-16-2019, 06:46 PM
    Thread: Printing class results returns 'none'
Post: RE: Printing class results returns 'none'

(Aug-16-2019, 12:53 AM)Windspar Wrote: It because you print the method return. There nothing to return so None is return. Remove the print fromprint(player.getStats()) and None won't print anymore. ...
Lawr3y Game Development 5 4,740 Aug-16-2019, 01:14 AM
    Thread: Printing class results returns 'none'
Post: Printing class results returns 'none'

Hi, I've recently got into learning the Python language using Python 3.7. I'm using the base of a text rpg to sort of learn the ropes of Python since it's something that I am interested in. I designat...
Lawr3y Game Development 5 4,740 Aug-16-2019, 12:22 AM
    Thread: catch input type error
Post: RE: catch input type error

import re number = input("Enter a number: ") if not re.match("^[0-9]*$", number): print("Entry must be a number")You can put this in a while loop to continue asking for input until it accepts the ...
Lawr3y General Coding Help 5 3,033 Aug-10-2019, 06:51 AM

User Panel Messages

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