c ++ – Random Number Generator Game

using namespace std;
void wrapUp() {
    cout << "-------------------------------------------------" << endl;


int main() {
    string name;
    int player;
    int livesTracker = 5;
    int x = 1 + (rand() % 10);

    cout << "Hello, what is your name?" << endl;
    cin >> name; 
    cout << "Welcome to guess the number, " << name << "!" << endl;
    cout << 'n' << "Number of Lives: " << livesTracker << endl;

    for (int round = 1; round <= 3; round++) {

        if (livesTracker == 0) {
            cout << "Game Over! Actual Answer: " << x << endl;
            system("Color 4");

        cout << "Guess the number that will come up on the screen from 1 to 10" << endl;
        cin >> player;

        if (player == x) {
            cout << "You won round " << round << "!" << endl;
            x = (rand() & 10);
        else if(player > x){

            cout << "Your guess was too high, round" << round << "!" << endl;
            cout << 'n' << "Number of Lives: " << livesTracker << endl;
        else {
            cout << "Your guess was too low, round" << round << "!" << endl;
            cout << 'n' << "Number of Lives: " << livesTracker << endl;

        if (round == 3) {

            cout << "For the hard level, you have to guess a number from 15!" << endl;
            for (int roundh = 1; roundh <= 2; roundh++) {

                int xh = 1 + (rand() % 15);

                    cout << "Guess the number that will come up on the screen from 1 to 15" << endl;
                    cin >> player;

                if (player == xh) {

                    cout << "You won round " << roundh << "!" << endl;
                    cout << "-------------------------------------------------" << endl;
                    xh = 1 + (rand() % 15);
                else if (player > xh) {

                    cout << "Your guess was too high, round " << round << "!" << endl;
                    cout << 'n' << "Number of Lives: " << livesTracker << endl;
                else {
                    cout << "Your guess was too low, round " << round << "!" << endl;
                    cout << 'n' << "Number of Lives: " << livesTracker << endl;





This program first creates a random number before entering the cycle. A livesTracker The variable is created to control the player's life. The first cycle runs until the player finishes the first round / level. If the player obtains the randomly generated number correctly, a new random number will be assigned to x to start the next round, until the player runs out of lives or wins the game, this will happen.

I just wanted to explain the program because it is probably too complicated to read, I appreciate any help!

For the physical board game, how do you restrict the vision of PCs in situations such as fog?

For situations such as Obscureing Mist, darkness and other visual disabilities, how have you succeeded in the physical board game?

Success measurements:

  • Players can manipulate their character in a battle grid to explore the restricted viewing area
  • The DJ can interrupt players when their sensory information changes without significantly interrupting the game in each round.
    • Ideally, you should also avoid constantly moving them backwards.
  • Do you have any method to provide information to players about what their character perceives
    • Ideally, only the player who "should" have the exact knowledge would have it, and others only what they can convey

The good response (s) will follow the concept of Good subjective and cover key points:

  • What has been your experience using the system?
    • that is, comments from the players, how did you feel it worked
  • How could you restrict your view and also reveal information
    • Did you just tell the player? Did everyone know when Bob was next to the bad guy?

Related question to play online with the Roll20 virtual table: in Roll20, how do you restrict PCs? vision in situations like fog?

Effect – VFX Spritesheet / flipbook – Game Development Stack Exchange

I have a question. Can anyone suggest me a good market where I can buy good spritesheet / flipbook VFX?

I am trying to avoid the Unreal or Unity market.

Thanks in advance!

develop a car game using the c program

I am an engineering student, I want to make a project using the c program related to car games, so I want some instructions to develop the project. Therefore, send some instructions and some examples related to the project.
Thanking you.

Unity – Game requirements for my game?

Thank you for contributing a response to Game Development Stack Exchange!

  • Please make sure answer the question. Provide details and share your research!

But avoid

  • Ask for help, clarifications or respond to other answers.
  • Make statements based on opinion; Support them with references or personal experience.

Use MathJax to format equations. MathJax reference.

For more information, see our tips on how to write excellent answers.

netbeans – Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 4 in Hangman game

I am something new in programming, and I am doing a hanging game in Java with NetBeans, but when trying to print the letters that the user is putting correct inside a Label, I get the following error:

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 4
    at juegoahorcado.Ahorcado.palabraFacil(Ahorcado.java:28)
    at juegoahorcado.Ahorcado.txtPalabraActionPerformed(Ahorcado.java:113)
    at juegoahorcado.Ahorcado.access$000(Ahorcado.java:8)
    at juegoahorcado.Ahorcado$1.actionPerformed(Ahorcado.java:68)
    at javax.swing.JTextField.fireActionPerformed(JTextField.java:508)
    at javax.swing.JTextField.postActionEvent(JTextField.java:721)
    at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:836)
    at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1668)
    at javax.swing.JComponent.processKeyBinding(JComponent.java:2882)
    at javax.swing.JComponent.processKeyBindings(JComponent.java:2929)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2845)
    at java.awt.Component.processEvent(Component.java:6316)
    at java.awt.Container.processEvent(Container.java:2239)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
    at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:835)
    at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1103)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:974)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:800)
    at java.awt.Component.dispatchEventImpl(Component.java:4760)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:733)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I am very new to this and I really don't know what it is, does anyone have an idea of ​​what my mistake is or what I need to add?
I hope I have explained my problem well, any help or advice to improve is well received here is the program code:

    private void palabraFacil(){
    String() palabras = {"cara","popo","pato","gato","duro"};
    int palabraRandom = (int) Math.floor(Math.random() * (palabras.length));
    String palabra = palabras(palabraRandom);

    char () palabraUsuario = palabra.toCharArray();
    char () letraFinal = new char (palabraUsuario.length);
    char letra = txtPalabra.getText().charAt(0);

        for (int i = 0; i 

Do I need authorization from Microsoft to support Xbox 360 controllers for a PC game?

Do I have to pay Microsoft or do I need some type of license to support the xbox driver in a PC game? Or do I simply implement it and let people use their Xbox 360 controllers?

Programming – neural network for a simple game?

I am taking a class that is based on the Mathematica coding language, and we must do a final 6-week project. I am considering coding a neural network for a simple game like 2048, pacman, snake, etc. What should I keep in mind when choosing a game and writing the network for this project to run smoothly?

Game design: implications of varying 2D race speeds

I'm getting my feet wet trying to design and implement a 2D action platform game. Combat will be a great approach, so I want to have a narrow ground and air control so that players can be precise and express dominance. For now, I don't think I want times of high acceleration and deceleration, since I think they detract from a feeling control scheme & # 39; tight & # 39 ;, but feel free to correct me if there are data or examples that say otherwise .

I'm very inspired by combat and I want it to look like a fighting game. From a surface level analysis, in many fighting games, especially crushing brothers, there are usually two (or more) horizontal movement speeds: a walk and a run, a run and a sprint, and so on. Naively, I thought "good fighting games have it, so if I want this to feel like a fighting game, I need to have it too," but if I think about it a little more, I'm not sure if it's worth implementing. Mainly because I don't understand the implications of having a sprint mechanic or not.

One thing that I am quickly discovering is that any design question can be reduced to & # 39; it depends & # 39 ;, especially on the game itself and on what I want to achieve. If you need more context, my initial idea is to unite more closely the feelings you get when you make a new combo or link or discover new ways to use a system mechanic in a fighting game with that sense of discovery when opening a game. World in a Metroidvania. Then, a 2D Metroidvania with action / fight game level combat. My initial thought is that the sprint would open the opportunity for board attacks, maybe some cancel, and make it easier to move around the world. It also means more implementation work, because most of the time I don't have buttons, so I would have to do some kind of double-touch analog input or smash attack to work.

My main example of two race speeds in a non-fighting game is in some Kirby games, where you can start a race by touching one direction twice. In the context of Kirby, what makes the board for the game as a whole? Would it be better to have a faster base speed and not run? What opportunities would open if I had a sprint and what would close?

Perhaps a better example, although not in 2D, is Raiden & # 39; s Ninja Run from Metal Gear Solid Rising Revengeance. It helped him move from one encounter to another faster, and served to close gaps while he was under fire.

The initial reaction says that my players will only use sprint to run from one encounter to another and they will lose the things I put that they might not do if they are taking their time. I would have to put things that encourage the player to slow down and be smart about it so as not to feel that I am destroying the player's rhythm. I think & # 39; go as fast as I am allowed & # 39; It is the default mode for most players, and having a variable running speed does not add much choice. I think that going fast, especially going faster in comparison, is fun, but is it a valuable compensation? I could compensate for this with a resistance system just for running or some other artificial limiter, but I think that opens up a new set of implications that I still don't fully understand.


What are the benefits and disadvantages of having a sprint?

dnd 5e: is there any spell, object or other feature of the game that gives my character an idea of ​​the weaknesses and resistance of an enemy?

This is a slightly different way of looking at it, but its history, arcana, nature and survival skills offer you the ability to get an idea of ​​the weaknesses of your opponents in different situations. Speaking directly to your example, an Arcana Check could tell you why the wizard was not suffering damage.
In addition, a simple wisdom Chk can be used to:

"Have an intuition about what course of action to follow."
P178 of the players manual.

This also maintains the relevant skills in combat, and gives rogues and bards an adequate advantage of having many skill spaces.

A stone of good luck p205 from the Dungeon Master's Guide will give you +1 to all abilities.
If you want something "bestowed" out of your character's normal abilities, an artifact skill (dungeon master's guide p219) is to have mastery of a skill that has been granted to you. So you can work with your GM to have a sword or magic helmet, that gives you specific skills in order to identify weaknesses in your opponents!