jnrchewie
@jnrchewie
“Walking on water and developing software from a specification are easy if both are frozen.”
― Edward V. Berard
1
space adventure A game where you are stranded in space and cannot leave until you finish of the intruder
v1
added spelling checker and save, load mechanism1
space adventure A game where you are stranded in space and cannot leave until you finish of the intruder
20
3
1
every time i run the program it shows the image but then gives me an error
it is warning me that the main file is not a header file and that i cannot use a #pragma once because of this
C++
1
0
replitit is a replica of replit
share with your friends
sorry
7
0
0
when i run the code it comes up with the error: 'TokenError: EOF in multi-line statement on line 35' but there is no line 35? how do i fix this
Python (with Turtle)
i want to change the text color like i did in space adventure but i dont know how to do it in c++
please help
Bookie0 Check out a tutorial here (scroll down to colors):
ANSI Escapes Codes
Now you might be wondering, how can I change the colour of the console text? Squids can chnage colour, so why can't the console? Well you actually can!
There's something called an ANSI code. It let's you specify what colour your text should be! You can use it like this:
cout you can also specify RGB values for ansi escape sequences
this can be done with
\033[38;2;;;m
you can also set the RGB of the background using
\033[42 years ago
i want to make a save system that creates a file for each player with there save in the folder user. So how do i make it so that the load_save void se
C++
YeetMstr I think instead of using a folder, you should use one file that stores all the info with a split like - per user and / per item in the save
just a suggestion2 years ago
how do i replace gun in the array no matter where it is in the array?
CodingCactus You can use .index() method to get the index of "gun" in the array and then use that to replace it. If "gun" isn't in the array it will error so you may want to check it is in first.
e.g.
array = ["cactus", "spike", "gun", "desert"]
if "gun" in array:
array[array.index("gun")] = "not a gun anymore"
else:
print("gun isn't in that array")
`2 years ago
RYANTADIPARTHI Solution
maybe, try something like this.
strings = ["something", "gun", "ball", "fel"]
new_strings = []
for string in strings:
new_string = string.replace("gun", "replaced")
newstrings.append(newstring)
print(new_strings)
maybe that should work.2 years ago
like
plr_ans = input("what do you want to do")
if plr_ans == "put the tablet down":
is there another phase i can use
ObiVibKenobi @jnrchewie There is one I can think of, but that works too.
if (input(“What do you want to do?”) == “put the tablet down”):
print(‘ok’)
`2 years ago
RYANTADIPARTHI That's good. It's basic, but you can use a phrase of your choice. whatever appeals to you.2 years ago
What is circular import and how do I fix it?
RYANTADIPARTHI you have errors wherever you put a fail at. I think you have to put the message manually, instead of calling a function. another thing is, you have parameters in your function, but when you are calling the function, you aren't filling out the parameters.
do that, and you'll be set2 years ago
how do i fix a circular import so that went they die they have the choice to restart and go to main.
Coder100 Why would you import main? Ideally, you would define functions that were to be called in combat, but that's all. Don't import anything else, and if you need to access some of those variables, just pass them in like function args
def a(b):
...
`2 years ago
go through the door and you will see
RYANTADIPARTHI The run of the program doesn't work for me, but one thing i can say is, you are importing combat.py but you don't have a real name for it. the server doesn't know which function or class. so if you want to use init, name a class, or if function, name is accordingly.2 years ago
InvisibleOne I think you should try naming your function in combat.py something other then init2 years ago
without using from keyboard import
MarcBauchet with that one, no need for root access in linux:
https://sshkeyboard.readthedocs.io/en/latest/
i had to install it in Replit though8 months ago
Wumi4 Just import them as usual!
The example from the official documentation
import keyboard
keyboard.pressandrelease('shift+s, space')
keyboard.write('The quick brown fox jumps over the lazy dog.')
keyboard.add_hotkey('ctrl+shift+a', print, args=('triggered', 'hotkey'))
Press PAGE UP then PAGE DOWN to type "foobar".
keyboard.add_hotkey('page up, page down', lambda: keyboard.write('foobar'))
Blocks until you press ESC.
keyboard.wait('esc')
Record events until 'ESC' is pressed.
recorded = keyboa2 years ago
'''How do I make it go to x ,y coordinates where y = m*x+c and x = 0 and has been answered''' after I have entered m and c it stops even though there
SUHASTADIPARTH1 You might want to keep calling the function that does the grid in a forever while loop or for loop2 years ago
RYANTADIPARTHI Try this:
turtle = turtle.Turtle()
x = 300
y = 500
turtle.goto(x, y)
You can use goto() to go to x, y coordinates
2 years ago