Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Oct 2013
Offline Last Active Yesterday, 04:09 PM

#5184255 how does it make the game?

Posted by Lactose! on 01 October 2014 - 02:52 AM


#5181622 Can you explain to me this code !

Posted by Lactose! on 19 September 2014 - 03:07 PM

If you enter 100, you will get to how_much = int(choice).

That means how_much is equal to 100.

In the next if statement, we check if how_much is less than 50. 100 is NOT less than 50, so we do not enter the if part of the if statment.

Instead, we enter the else part of the if statement.

Inside the "else" part the dead("You greedy bastard!") code run.

The dead code will print the text you see.




Like I've done before, I would suggest you slow down. You seem to be going too fast. You might be going through the exercises quickly, but if you don't understand them, you won't learn much.

The questions you're asking indicate you're missing some fundamental knowledge. I would urge you to back to earlier lessons, and not progress until you feel you understand basically every line in the lessons you're working on. If parts are unclear, I'm sure people will help you. That said, I would recommend you ask more specific questions.

Instead of "help what does this do" and post all the code for a lesson.

#5181150 Tilemap collision problem

Posted by Lactose! on 17 September 2014 - 04:43 PM

It will probably not move because it's stuck inside the collision.


One solution could be:

1. Store current player position.

2. Update the player position.

3. Check the new position for collisions.

4. If a collision was detected, move back to the original position (stored in step 1).

#5176024 Missile Command code review request

Posted by Lactose! on 25 August 2014 - 11:06 AM

I'm using Visual Studio, as far as I can tell it only compiles the files that have been edited, and if I'm not mistaken, I believe that it doesn't compile files just because they were included by another. Or, I could be totally wrong about that...

You can think of #include as basically copying the included file into the current file.


If "A.cpp" has #include "B.h", and something inside "B.h" changes, "A.cpp" will need to recompile.

#5175801 where to start...

Posted by Lactose! on 24 August 2014 - 07:44 AM

Have you checked out the FAQ? It contains a lot of good information when you're just starting out.


I wouldn't worry too much about learning "the wrong thing" -- almost everything you can learn is something you can benefit from, in some way or another.

#5175627 Game Designer vs Team Arguments

Posted by Lactose! on 23 August 2014 - 07:22 AM

A better word to use might be "discuss". To me "argue" is more hostile and more about trying to convince the other person, while "discuss" is more aimed towards finding a solution.


Regardless, having more eyes and thoughts on a subject can be a good thing. It can help you spot flaws you wouldn't have thought of yourself, and it can spark even better ideas.

#5175623 Increment Frame Bug

Posted by Lactose! on 23 August 2014 - 06:30 AM

As I mentioned in one of your previous threads, the point of using CurrentFrame = SDL_GetTicks() / 200 % 3 (or other values instead of 3) was a way to quickly/with a low amount of changes be able to help verify what was causing a bug you were having earlier. It was not suggested as a fix (explicitly so), because of various reaons, some of which have been pointed out by L. Spiro.


Your current problem might be caused by the contents of DownAttackTex -- we never see how this is created/filled. Possibly there's some uninitialized data here, or maybe you're accessing something out of bounds of the array.

I'd recommend setting a breakpoint at the function which makes the game crash, and look at what each variable in the function call evaluates to. This should hopefully help locate the problem.


That said, I'd like to reiterate both L. Spiro's and my own earlier comment. Once you've fixed this problem, you should take a closer look at how you're structuring and doing your sprites/animations. You're still fairly early in the process, which means fixing it and having a more solid foundation to work on will be very valuable and time-saving going forward.

#5175437 DeltaTime and acceleration

Posted by Lactose! on 22 August 2014 - 03:35 AM

Had you used correct formula you'd have identical result.

You've got a typo, 5.5 should be 4.5.


Apart from that, one of the reasons you (panicq) should use a fixed timestep is related to collision checking/handling. You can actually see it from Zaoshi Kaba's example; what if there's something you'd collide with at x = 4.5 (after 3 seconds), but which you would NOT collide with at x = 8 (after 4 seconds)?

How would you solve this issue? Now imagine having to deal with/special case all other issues like this. OR you could fix your timestep (a 1 time thing), and have the results deterministic regardless of what framerate the game is running at.


Note that even though the logical simulation (handing movement, collision, etc.) should have a fixed timestep, the render part does not need to have a fixed timestep. If you wanted (for some reason), you could force rendering to occur every 3 seconds, without impacting any of the logical/gameplay stuff.


Can you give an example of why a game would not want to have a fixed timestep? You claim this is the case for many games, but I can't think of a single game for which this is true.

#5175225 DeltaTime and acceleration

Posted by Lactose! on 21 August 2014 - 04:37 AM

Any Idea on what should be really done ?

The solution is to fix your timestep.

This will keep deltaTime consistent across multiple machines, meaning all calculations using it end up the same.

#5175037 Strange output when writing to a file object and printing it out

Posted by Lactose! on 20 August 2014 - 09:55 AM

We can't know if you're ready for the next tutorial or not.

If you feel like you understand all/most of the stuff that's been gone through so far in the tutorials, I would suggest moving forward.

If you feel there are things you don't understand completely, or things that you're uncertain about, I would suggest taking a closer look at those things, before you move on to the next tutorial.


In the end, that's a choice you'll have to make on your own.

#5175012 Am I obliged to create one?

Posted by Lactose! on 20 August 2014 - 08:46 AM

No one will expect you to create your own solutions if the existing ones are good enough for what you want to do.


If you have special reasons for creating or modifying something, then go for it. This can include "because I want to/for learning purposes".

Most people are more than happy with using the software you mentioned to create art assets for their games.


A lot of people (especially smaller studios) are also happy with using engines or frameworks (examples including Unity, Unreal Engine, GameMaker, etc.). If your goal is to create a game, then that should be your main priority.


Basically, it's like if you want to become a pro-cyclist. Your main goal would be learning how to cycle really fast, not worry about if you need to build your own bike.

#5174969 Best way to traverse a 2d array to dertermine the winner in Tic-Tac-Toe

Posted by Lactose! on 20 August 2014 - 05:24 AM

Also, even if you don't understand it all right now, it can still be used as a reference later on.

And it might help others who just lurk or happen to google the same problem.

#5174869 Apparently, no so simple Math.....

Posted by Lactose! on 19 August 2014 - 04:47 PM

All very nice! I do have one question. In this line of code right at the bottom, what is the 1 for? I get that we are trying to always do atleast 1 damage, but does that effect the code if normal damage is done? 


int x = max(attack - defense, 1);
is equivalent to
int x = attack - defense;
if (x < 1)
    x = 1;

#5174861 Apparently, no so simple Math.....

Posted by Lactose! on 19 August 2014 - 04:24 PM

It could also easily be non-UI related. E.g. every time you block all damage 4 times in a row, gain double damage for next attack. Do counter related things inside the if/else blocks. Just to continue the derail a bit.


But we both know you're just typing stuff here to avoid coding!

#5174856 Apparently, no so simple Math.....

Posted by Lactose! on 19 August 2014 - 04:18 PM

I see your min/max ops and raise you blocking logic!


int damageTaken = attack - defense;
if (damageTaken > 0)
    health -= damageTaken;
    Console.WriteLine("Attack blocked!");