Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

c++

  1. A

    C++ my code keeps returning -1073741819 (0xc0000005), what is the problem?

    #include <cmath> #include <stack> #include<queue> #include <iostream> #include <regex> #include <vector> #include <thread> #include <bitset> #include <ctime> #include <string.h> #include <math.h> #include <bits/stdc++.h>...
  2. R

    C++ Strcat Function In C++

    I'm new to C and C++ programming, can anyone give me a hint on what I'm doing wrong here. I'm trying to write to concat function that takes to pointers to chars and concatenates the second to the first. The code does do that, but the problem is that it adds a bunch of junk at the end. For...
  3. Bogdan Floares

    C++ C++ class meaning

    What is a cpp class an how does it work. In java and c# a class(marked as public) is pretty much just a source file, or a public class is associated with a source file, for example: Program.java: public class Program{ } Or Program.cs: public class Program{ } Or I can have some not...
  4. B

    C++ Non tail recursive function help

    if i have a function f(n)=3+8+14+24+⋯+(n2−1) how do i implement this into a function recursively without using tail recursion? it needs a static variable used also thanks!
  5. smackytacky

    C++ ArduinoJson <overloaded function with no contextual type information>

    This is the older version code for ArduinoJson v5.0: JsonObject& json_parsed = jsonBuffer.parseObject(json); This is after I changed it to ArduinoJson v6.0: deserializeJson=(doc, json); And after that, I got this error message C:\Users\wweih\Desktop\New folder (2)\free_code\free_code.ino: In...
  6. D

    C++ Implementation of Edmons-Karp algorithm c++

    I am trying to generate a random vertices and edges for my Edmon-karp algorithm, but I am unable to do it and I think that is useful formany of us, as there is no info on the internet how to generate automatically edges ant vertices. I am trying this method instead of inputting numbers by hand...
  7. P

    Intonew Startup (Join Us)

    5 positions open for a startup in Eastern, PA (long distance is most definitely an option thanks to technology!) Reinventing the way we see the world (more details during/after interviewing process) We are looking for (1 or many) A Programmer who is fluent in C, C++, or Java. (Arduino...
  8. P

    Tech Start-Up

    Looking for outside the box, grand thinkers, who constantly question the boundaries of life and society, looking ideally for someone proficient in C/C++ and/or HTML BUT completely open to interviewing any applicant who has a passion for solving problems. If you’re interested in a quick...
  9. LTomy

    Introduction to coding - 15. Conclusion

    Conclusion Improving the game There is a great amount of improvements that we could make to the game. It can however get complex pretty fast, so it is important to be comfortable with the basics of the programming language used before really getting into big projects. Learning to code in C++...
  10. LTomy

    Introduction to coding - 14. Adding shadows

    Adding shadows Lighting and shadows Simulating lighting and shadows can greatly improve the visuals of a video game. It may however get very complex. For the sake of simplicity, here, we will only handle the display of shadows (And in a simple way). Representation of colors Colors are often...
  11. LTomy

    Introduction to coding - 13. Buying and using potions

    Buying and using potions Obtaining gold Until now, there was no mean for the player to obtain gold. We will give the character a gold coin for each monster slayed. In the section of code executed when the player kills a monster, we will add the following code: // Increases the amount of gold by...
  12. LTomy

    Introduction to coding - 12. Adding a merchant and building

    Adding a merchant and building Adding the castle We will add a small castle at the bottom left of the window. We load its texture and create its sprite: sf::Texture castleTex; castleTex.loadFromFile("resources/castle.png"); sf::Sprite castle; castle.setTexture(castleTex); castle.setScale(4, 4)...
  13. LTomy

    Introduction to coding - 11. Making the monsters attack

    Making the monsters attack Storing information about the player To keep track of the health and the amount of gold and potions the player has, we define 3 variables: int playerGoldAmount = 0, playerPotionAmount = 0, playerHealthAmount = 3; How the monsters attack The monsters attack by casting...
  14. LTomy

    Introduction to coding - 10. Displaying information

    Displaying information Displaying text The class used to display text is sf::Text. sf::Text text; Similarly to how an object of type sf::Sprite needs a texture, an object of type sf::Text requires a font. A font specifies the shape of the characters (And other information) and an object of type...
  15. LTomy

    Introduction to coding - 9. Making the character attack

    Making the character attack Keeping track of whether a monster is alive or not A variable of type 'bool' can either equal 'true' or 'false'. Here, we define an array of 'bool' values indicating if a monster is dead or not: bool monstersDead[4]; In the loop where we assign the texture to the...
  16. LTomy

    Introduction to coding - 8. Adding monsters

    Adding monsters Displaying the monsters There are 3 textures for the monsters. To simulate an animation, we will alternate between them every 0.333 seconds. The textures: sf::Texture monsterTexs[3]; monsterTexs[0].loadFromFile("resources/monster1.png")...
  17. LTomy

    Introduction to coding - 7. Handling the collisions

    Handling the collisions Currently, collisions are not tested. The player can walk over the trees and stones. Let us resolve that. Testing the collision between two sprites The class sf::FloatRect is almost the same as sf::IntRect. The only difference is that its members (Representing its...
  18. LTomy

    Introduction to coding - 6. Adding the character

    Adding the character The sprite and texture The texture: sf::Texture playerTex; playerTex.loadFromFile("resources/player.png"); The sprite: sf::Sprite player; player.setTexture(playerTex); player.setPosition(400, 300); player.setScale(3, 3); Testing if a key is pressed The function...
  19. LTomy

    Introduction to coding - 5. Adding trees and stones

    Adding trees and stones Adding the trees The texture: sf::Texture treeTex; treeTex.loadFromFile("resources/tree.png"); The sprites: sf::Sprite trees[8]; trees[0].setPosition(50, 60); trees[1].setPosition(600, 150); trees[2].setPosition(630, 456); trees[3].setPosition(300, 600)...
  20. LTomy

    Introduction to coding - 4. Adding dirt

    Adding dirt Arrays When we have to create many variables of the same type, defining them individually may be inconvenient. In that case, it is better to create an array. An array is simply a group of variables which are individually accessed by their index within the array, rather than by...
Back
Top Bottom