Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Oct 2013
Online Last Active Today, 09:46 AM

#5168497 projected lines

Posted by Lactose! on 22 July 2014 - 04:40 PM

Oh my god I can't believe that worked!


(EDIT: Chat room humour.)

#5167491 Functions

Posted by Lactose! on 17 July 2014 - 04:04 PM

With your current code, you can only call askYesNo1() from inside main. You can't call askYesNo2().

This is because main hasn't heard about askYesNo2() yet -- it comes after, after all!


You can keep the order you want, and still make main able to call askYesNo2() by forward declaring it higher up, like so:


char askYesNo1()
    // ...
char askYesNo2(); //Declaration, just lets rest of code know that a function with this signature exists and can be called
int main()
    return 0;
char askYesNo2() //Definition, containing the code that will actually run
    // ...


How you order functions is just for organization.

#5167457 Need advice for developing a game?

Posted by Lactose! on 17 July 2014 - 12:56 PM

You should check out the FAQ.


That should get you started, and you can ask more specific questions after :)

#5167028 Theoretical Tile-Based Question

Posted by Lactose! on 15 July 2014 - 11:44 AM

There are several ways. You can use masking within a pixel to indicate collision or interactable areas, like megadan says.


For the collision issue, you can also solve it using math, in order to figure figure out all kinds of things apart from just "is this tile full-on collision?".

You might have a tile which is flagged as "collision starting from bottom left, going upwards in a 45 degree angle to the right". The actual collision for the tile's pixels can then be determined by a simple linear formula: mx + b, with m being the slope and b being the start offset.


You might also then have collision which is only checked if the player is below (or above, or from the left/right), which would allow you to pass through the collision in some directions. Collision does not need to be "nothing can ever penetrate this square tile" -- although it can be. It depends on what you need/want.


In both cases, you need to do more checking that just on a tile level. You'll want to store and check a more finely detailed position.

#5166452 Javascript Won't Run with Tutorial GitHub Code

Posted by Lactose! on 12 July 2014 - 01:49 PM

In fact, mistaking Java for JavaScript is like mistaking 'Ham' for 'Hamster'.

#5165103 Animating With Separate Image Files

Posted by Lactose! on 06 July 2014 - 01:55 PM

If this code is executed once per render loop, the image will NOT be drawn 1 frame every 7 frames. This is what causes the flicker.

This is because if CurrentFrame is 6 upon entering this code, it will be incremented to 7. It will then bypass all the other ifs, and go to the == 7 part.

Here, it will be set to 0 (so that it runs 1 next loop), but it will not do any drawing this loop.

You can fix this by doing a separate if check right after incrementing, that sets it to 1.


However, there is a lot of (almost) identical code here. You could change all of the above (with the fix I mentioned) into the following:

gAidan.CurrentFrame %= 7;

If this looks a bit like magic, ask and I'll explain what's going on.

#5164899 Old Keyboard State in Input Handler

Posted by Lactose! on 05 July 2014 - 10:42 AM

but I guess that may be due to the way the keyboard is wired.

You can test your keyboard for ghosting issues (and read more about the issue) here:


#5164866 I want to be a game developer.....so what should I so ?

Posted by Lactose! on 05 July 2014 - 06:58 AM

I think you should read the FAQ. Most of your questions seem to be there.

#5164791 How To Save A Non-Grid-Based Level For A Game

Posted by Lactose! on 04 July 2014 - 03:01 PM

There are loads of ways of doing it.

How a level is saved will depend greatly on what specific things you need saved, and how the game will interpret them.


One way to solve your specific issue is to store a position and a rotation, either as some floats and some rotation angles or something, or by basically having the entire 4x4 matrix stored in the level's file.

Made-up example:



ObjectName = "MyObject"

ObjectType = "AwesomeObject"

ObjectPos = 100.023f, 39.5f, -882.0f



Then, in this example when loading, the editor/game would see a new object block (from the "Object_Start" keyword), would assign its name and type based on the next keywords, and put it in the exact position you wanted it, based on the position data.

#5164759 encryption my password

Posted by Lactose! on 04 July 2014 - 10:11 AM

Do you have a question or a problem? I don't understand what kind of replies you're wanting.

#5164754 simple SDL framerate?

Posted by Lactose! on 04 July 2014 - 09:55 AM

Is it me or is L.Spiro assuming that framerate limiting is only done for hardware limitations and not to simplify gameplay logic? (it's much easier to do things like physics if you know the interval between frames is always the same)

A fixed timestep solves that.

To repost the link: http://gafferongames.com/game-physics/fix-your-timestep/

#5164660 So... I'm a Molecular Biologist....

Posted by Lactose! on 03 July 2014 - 03:59 PM

While this might only be tangentially relevant, you might want to look at the game SpaceChem. You might find it interesting, and it might give you some ideas in terms of puzzle gameplay with a molecular flavour.



#5164298 Seperated world intro smaller chuncks, object occupies more the none chunk

Posted by Lactose! on 02 July 2014 - 06:40 AM

Spatial partitioning?



EDIT: Also see the references at the bottom for other methods of partitioning.

#5163917 very strange bug (when runing c basic arrays code)

Posted by Lactose! on 30 June 2014 - 02:16 PM

Debuggers help you find and fix bugs quickly

It's almost as if the name of the tool was a hint to what it should be used for.

#5163706 Need more than 1 value to unpack?

Posted by Lactose! on 29 June 2014 - 03:19 PM

When you run it from Notepad++, you haven't passed in any arguments. I don't currently have Notepad++ installed, but I'd guess under the "Run" filemenu there'd be an option to specific command-line arguments.

I may be remembering incorrectly, but I believe Notepad++'s run option just makes you type in the arguments after the (filepath +) filename. Just like the command line.