Jump to content

  • Log In with Google      Sign In   
  • Create Account

ultramailman

Member Since 13 Oct 2012
Offline Last Active Oct 26 2014 08:19 PM

#5157956 How to make a character fall off the block after it has been on it

Posted by ultramailman on 03 June 2014 - 04:39 PM


How to prevent the character from jumping again if it is already in a "jumping state"?

 

Your question kind of answers your question.

Make separate states for "initiating the jump" and "jumping" (I like to call it "falling").

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMP;
}
else if(state == ActionState.JUMP) // .... and then in the next frame
{
state = ActionState.JUMPING;
}



#5155580 A list that does not disturb the order when pushed/popped?

Posted by ultramailman on 23 May 2014 - 10:11 PM

That sounds like a job for an array-like data structure. So I think a vector is suitable for this. When you remove the item, you mark that item's slot as unused.




#5153454 How do you know if you are not reinventing the wheel in your language

Posted by ultramailman on 13 May 2014 - 09:35 PM

Whatever you do, you are probably reinventing the wheel. I don't think there's anything wrong with it though. If you have a problem and you come up with a system to solve it, good for you, and you learned something, wheel or not.




#5150713 SDL audio callback buffer size

Posted by ultramailman on 01 May 2014 - 01:56 AM

@ LongPointer, you are right, using checkspec.wav is kind of silly. I don't use it anymore. As for filling the numbers in after OpenAudio, it doesn't work, because I already got the audio device.




#5148857 SDL 2.0 and String Constructor Errors

Posted by ultramailman on 22 April 2014 - 06:12 PM


Why isn't it guaranteed the prints will run? I know some people say some prints might break during certain situations but I don't really understand why. If the if statement is true, then the program has to run the print before it can return right?

 

The print function run, it's just that they might not actually print to the screen until you flush the buffer or the buffer gets full.




#5148658 2D physics, random line geometry, many balls, and jitter problem

Posted by ultramailman on 21 April 2014 - 11:48 PM

Another way is to perform your collision solving step multiple times per frame, because solving collision once could lead to new collisions. So think of it as a fixed point method, refining your physics world the more times you run it.




#5148655 2D physics, random line geometry, many balls, and jitter problem

Posted by ultramailman on 21 April 2014 - 11:16 PM

I don't understand the concept yet, but "speculative contacts" is one way to go.

http://www.wildbunny.co.uk/blog/2011/03/25/speculative-contacts-an-continuous-collision-engine-approach-part-1/




#5148592 undefined reference to `SDL_main'

Posted by ultramailman on 21 April 2014 - 01:59 PM

Let me give this a shot.

 

When doing the linking step, you use:

 

g++ -o Main.o -LD:\SDL2\i686-w64-mingw32\lib -lmingw32 -lSDL2main -lSDL2

 

This looks like you want to link nothing to the libs, and output it to a file called Main.o. Try changing it to:

 

g++ Main.o -LD:\SDL2\i686-w64-mingw32\lib -lmingw32 -lSDL2main -lSDL2

 

instead. This means you want to link Main.o to the libs, and output it to "a.exe"




#5148411 SDL 2.0 and String Constructor Errors

Posted by ultramailman on 20 April 2014 - 03:58 PM

I don't see anything obvious, but try changing

test i = test(100,100); // creates temporary test object and assigns the temporary object to the object i

 

to

test i(100, 100); // this creates test object i, and calls constructor of i



#5148016 Keyboards that don't Key

Posted by ultramailman on 18 April 2014 - 05:51 PM

Since it's a hardware limitation, one way to go around that problem is to allow the player to customize key bindings. That way, if my keyboard can't accept key A and key B at the same time, I'll just change the keys until I'm satisfied with it.




#5147228 How to stop users from manipulating Game Save Data

Posted by ultramailman on 15 April 2014 - 05:42 PM

As long as the user has access to the file, it can be modified. You can stop the average user from being able to make sense of the file by obfuscation (encrypt it, or compress it).

 

I would just leave it in plain text, and just not bother with stopping the people from modifying the game saves.

 

If you must not allow it, you will have to store the game saves in a remote hard drive, so that users can't access it.




#5142116 SDL2, mingw64, and Code::Blocks

Posted by ultramailman on 25 March 2014 - 04:23 PM

Building SDL2 using mingw was pretty simple, it's just a cmake -G"MinGW Makefiles" followed by a mingw32-make.




#5139289 random generators

Posted by ultramailman on 15 March 2014 - 01:37 PM

Hello.

 

I've just switched from int rand(void) to c++11's random library, with all the engines and the distributions.

 

So It's pretty convenient to be able to have the distribution objects to generate uniform floats or integers, but I wonder if there is the need to have multiple engine objects in one program.

 

Let's say I use randomness in three different ways, in the same game, in no particular order:

1. generate a uniform x position from 0.0 to 100.0 (enemy spawn location)

2. generate a uniform fraction [0.0, 1.0) (enemy spawn chance)

3. generate a uniform integer from 1 to 3 (randomly choose a power-up)

 

Is it "more correct" to use one generator with its own seed for each purpose, or it is fine to just use the same generator with different distributions?




#5137586 Not able to implement classes to get Polymorphic Behavior

Posted by ultramailman on 09 March 2014 - 12:47 PM

So it seems, Kanefa , that what you are are trying to do with the getString is not polymorphic behavior.




#5137362 Not able to implement classes to get Polymorphic Behavior

Posted by ultramailman on 08 March 2014 - 11:57 AM

The base class is missing getString(). It'll need that if you want all Event types to provide some kind of info string. But if you only want getString in EventStr, then casting seems to be fine.






PARTNERS