Skip to content
Sign UpLog In
Profile icon

Coder2195

@Coder2195
I live in the Andromeda galaxy 🌌 β˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈβ˜„οΈ
Twitter
GitHub
Website
Repls
Community
Coder2195
Coder2195
shared a Post
β€’2 years ago
Collab
Title is explanatory Must know how to use webpack, pixijs, websockets
Coder2195
Coder2195
shared a Post
β€’2 years ago
So I have found this solution to a problem I had earlier It involves cloning audio nodes But my question is that if I clone it will the current loaded
Coder2195
Coder2195
shared a Post
β€’2 years ago
Scratch provides a β€œstart sound” block How do I simulate that in JS Also, what event listener is the one to check when audio FULLY loaded?
Coder100
Coder100
well the classic way would be to create an audio element then .play() it. if all else fails, you could resort to a library https://howlerjs.com/2 years ago
BrysonVan1
BrysonVan1
1). Start Sound with JS - try looking at this w3schools tutorial. I've used this in the past and it works pretty well. https://www.w3schools.com/graphics/game_sound.asp 2). ` const audio =//get audio by ID or Class, etc audio.addEventListener("load",() => { //Audio is loaded... })`2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
Screenshot 2021-03-16 at 12.04.04 PM Look at this. Yet on the python replit, I don't hear anything
Coder100
Coder100
but anyways, that's why they specifically said replit audio is EXPLORERS-ONLY meaning it is not STABLE and it is not GUARANTEED to work. Sometimes these features even get removed!2 years ago
Coder100
Coder100
ah yes i am number one on the weekly leaderboard cool image2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
I'm making a little sign in thingy, but in the future this data that is in a env file is going to expand and I MIGHT need it to work on a database ins
Coder100
Coder100
I recommend use replit db: https://docs.replit.com/misc/database ALSO WHY IN THE WORLD ARE YOU USING .ENV TO STORE DATA it won't work .env is meant to store secrets (like tokens, database keys, etc.), they are NOT meant to store code or anything like that.2 years ago
icodeletion
icodeletion
The database is not in a file. I think.2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
The scratch GUI is a great GUI with its exporting and importing with sb3 files I want to know how does scratch do it According to stack overflow the
tussiez
tussiez
If you're using NodeJS: const fs = require('fs'); let someTextFile = fs.readFileSync('file.txt','utf8'); // the file // change the file fs.writeFile('file.txt','Hey want a rickroll'); `2 years ago
Coder100
Coder100
Simple after you obtain the file, convert it into a blob, and then: https://developer.mozilla.org/en-US/docs/Web/API/Blob/text and then: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL or however else you find you want to do2 years ago
notGilbert
notGilbert
you cant edit files directly on the disk, however, you can upload modify, and download you can save the data into a JSON or a . file to export data do you have a sb3 file so i can look inside of it?2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
I've been trying to learn Pixi.js I need help understanding texture altas They say you only need to load json file But how will the pixi read the tile
mwilki7
mwilki7
It depends how the json file is parsed and whether paths to your tilesheet was put into it. This website goes through setting up a basic scroller (which includes loading images) http://www.yeahbutisitflash.com/?p=5226 var texture = PIXI.Texture.fromImage("path/to/your/tileset/here.png"); `2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
Which is faster to render 121 tiles? 121 img elements or 121 images drawn on canvas I want to opmitze the faster one
RYANTADIPARTHI
RYANTADIPARTHI
image is faster than canvas. Here's some proof. https://stackoverflow.com/questions/15541183/canvas-vs-img-performance2 years ago
19wintersp
19wintersp
I think it's faster to have a canvas, because there are less elements. Note however that canvas would require using JavaScript, and an image is purpose-built to draw images. Are you showing multiple, different ones, animating them, or just showing them statically?2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
Python has not supported sound for quite a while now. Are the developers planning to add sound? When will this happen? Will this even happen?
EducationalChan
EducationalChan
https://replit.com/@EducationalChan/speak#main.py9 months ago
RishiMohanty
RishiMohanty
sound with python on replit doesn't work. I mean, when you run something with sound It will sometimes play and other times it won't. The tnkter module is also unavailable so you can't use that either. The playsound module gives an error when you try to download the package. os.system also doesn't work for some reason whatsoever. there is a way, I forgot how, where you can play a .wav audio file and it plays without an error but you can't hear it. So basically all in all you can't play audio with1 year ago
19wintersp
19wintersp
You've already received two good answers, though I'd just like to clarify: Python does not have a built-in sound library, and I doubt they will add one due to the issues with compatibility. Python has third-party libraries made by the community to support sound, some dedicated (such as playsound or simpleaudio) which you can install from PyPi. Replit, however, runs your code remotely on a container in their servers, so any sound produced would not get to you, in the browser, if it was even produ2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
look: I have these clones in this list: for example: clones = [new clone(), new clone(),new clone(), new clone(), new clone(),new clone(), new clon
SixBeeps
SixBeeps
Iterating is the only way of doing this. There are faster and cleaner ways of iterating other than just the normal for-loop. The forEach loop should work for you use case: clones.forEach(clone => clone.forward()); `2 years ago
Coder2195
Coder2195
shared a Post
β€’2 years ago
I'm making a 2d Minecraft with JS (don't ask where it is) I need this encoding and decoding system (I don't know how to describe it with words so I'm
programmeruser
programmeruser
function encode(data) { let count = 0; let currChar; let str = ''; for (const ch of data) { if (ch === currChar) { count += 1; } else { if (currChar) { str += currChar + count.toString() + ' '; } currChar = ch, count = 1; } } str += currChar + count.toString(); return str; } function decode(data) { let str = ''; for (const ch of data.split(' ')) { str += ch[0].repeat(Number(ch[1])); } return str; } `2 years ago
19wintersp
19wintersp
function encode(data) { let last = ""; let count = 0; let out = []; for (char of data) { if (last == char) count += 1; else { if (last) out.push(last + count); last = char; count = 1; } } if (last) out.push(last + count); return out.join(" "); } function decode(data) { let out = ""; for (part of data.split(" ")) out += part[0].repeat(parseInt(part.substring(1), 10)); return out; } Edit: if you want excessive shorthand: const encode = d => 2 years ago