Skip to content
Sign UpLog In
Profile icon

Cullen D'Avello

@CullenDAvello
Repls
Community
CullenDAvello
CullenDAvello
shared a Post
3 years ago
Having trouble with textures and sprites
Ok so, (I’m using SFML) I have (had) set up a Texture texture; if (!texture.loadFromFIle(“texture.json”)) and I had the sprite code but when I went
The Destroyer
polygott
SPQR
SPQR
I can't really do it for you without knowing exactly what you're trying to accomplish, maybe try re-adding your Sprite so we can help you fix the errors and show you what you did wrong? Also I have some projects of my own i'm currently working on but i can certainly help you out here and there :)3 years ago
CullenDAvello
CullenDAvello
shared a Post
4 years ago
OK I've been making a game for a little bit, lots of rectangles not many patterns so I've finally decided to use a tile set but i don't know how can a
SPQR
SPQR
Hello, Sorry for the (very) late response, I've been out of state and thus away from my computer for about a week and a half. @mwilki7 did a really good job of explaining this, and there isn't really much else to be said. If you end up needing anything else, though, just @ me. :)3 years ago
mwilki7
mwilki7
It will take a bit of time nailing all the coordinates for your tileset but once you find all the coordinates it shouldn't be a problem. After taking a look at the documentation, you should be able to use your tileset by: loading the texture convert from texture to sprite sizing the sprite drawing the sprite Declared variables: sf::Texture texture; RenderWindow window(...); For loading: if (!texture.loadFromFile("image.png")) { // error... } For converting: sf::Sprite sprite; sprite.se4 years ago
CullenDAvello
CullenDAvello
shared a Post
4 years ago
i have a function on lines 93 through 97 that i want to only run every second i have it so when the player touches the enemy he loses 1 health but i
Pythonier
Pythonier
I'm pretty sure delay(Milliseconds) would work. So you could write something like: delay(10) // delays 1/100 of a second `4 years ago
CullenDAvello
CullenDAvello
shared a Post
4 years ago
hey @SPQR can you help me with on screen text the SFML website says the code i have on lines 87-91 is right but it says "font" is undeclared even thou
abc3354
abc3354
Hi ! This question was answered but I drop a tutorial link for anyone else ;) https://www.sfml-dev.org/tutorials/2.5/graphics-text.php4 years ago
SPQR
SPQR
So, you have to use the built-in fonts that come with xterm, change times new roman to one of the fonts in the x font directory. I used "/usr/share/fonts/X11/misc/ter-u16b_iso-8859-1.pcf.gz"4 years ago
CullenDAvello
CullenDAvello
shared a Post
4 years ago
@SPQR hey, i started using SFML because SDL didn't get me anywhere and you were right SFML is way easier, but i keep getting this unqualified-id erro
SPQR
SPQR
Basically, you have a problem with your brackets. If you delete a few of the lines with extraneous brackets that should help. Also, there's some other problems with parentheses that i fixed for you. Also Also, not sure what you're doing with the "collision" namespace. Did you mean to use a class or struct? Also Also Also, you have window.setFramerateLimit(60); outside of int main(). You need to run functions inside of other functions, this is fixed by simply moving it inside the brackets. That4 years ago
CullenDAvello
CullenDAvello
shared a Post
4 years ago
i have been made aware that using the SDL api is a lot easier than normal c code and i was wondering if there is a way to use it on repl. i have all o
SPQR
SPQR
https://repl.it/@SPQR/SDLtest made this a while back as a proof of concept. Like @theangryepicbanana said, though, SDL_image doesn't work yet, so I'd recommend using SFML instead, which I have working at https://repl.it/@SPQR/SFML. SFML is (in my humble opinion) easier to learn and use anyways and for a beginner (which I assume you are) is the more viable choice imo.4 years ago
theangryepicbanana
theangryepicbanana
you can use SDL/SDL2 fine, but it doesn't have SDL_image yet4 years ago