Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tigre Pablito

Pages: 1 ... 4 5 [6] 7 8 ... 15
76
SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 25, 2018, 02:54:14 am »
If an object needs to know some data of another object (that is very common), the only way (at least what my experience tells me) is to pass a reference of the 2nd to the 1st(*). Usually in my games, every enemy or animated object (such as blocks in Super Mario games) has a reference of the player (that is passed in its constructor) and so they are able to process both their atacks to the player and player's attacks to them.

If the bird is your game main character, I think it would be better that the other objects have a reference to it. In your game class you create a Bird object, and then when you create the enemies and other objects, you pass them a reference to the Bird. So they can read and modify the player's attributes, and theirs, in function of it. Because the bird's control depends on you (even if you crash against an enemy and die), not on the enemies, but what they do (attack you, die if you kill them, etc) does depend on the bird (and on other instruction set or behavior you program them to do that are independent of anything). That's why it is better to pass a reference of the player to the other objects and not on the contrary.

(*) Remember that in C++ the subject of references and pointers and all that stuff is not simple as it is in C#.

Hope this helps

77
Graphics / Re: Sprites not positioning the way I established
« on: December 22, 2017, 09:24:41 pm »
Why don´t you draw an equal size cell checkerboard? I don´t think it would be so hard, and surely mathematical things would be very much easier for you  ;)

78
General / Re: Game Physics
« on: December 16, 2017, 07:37:03 pm »
Hi lukaius

Maybe the most precise way is to use the quadratic function to get a parable effect

Let's say maximum jump height is 'maxHeight'

Then we can have the formula -x^2 + maxHeight  (-x^2 is the same as -(x^2), NOT (-x)^2)

Suppose the way from the floor to maxHeight lasts 30 frames (you can change this)

Your 'x' should start in -Sqrt(maxHeight) + Sqrt(maxHeight) / 30

When x == -Sqrt(maxHeight) you are about to take off

When x == 0 you are at maxHeight

When x == Sqrt(maxHeight) you have landed (*)

(*) It may happen that the land where you are traveling is not flat at all, so you may land before reaching the Y position from where you took off or after that (in which case you just need to stop the jump or continue it until you reach the floor, respectively)

What concerns to X scrolling is another issue that has nothing to do with this

The code


when (jump key is pressed)
[ if (player.Floor()) { n = 1; floor = y; player.position = Positions.Jump; } ]
// n is the number of frames from take off

// this should be into your player method
if (player.position == Positions.Jump)
{
    y = floor -(-pow(-Sqrt(maxHeight) + n * Sqrt(maxHeight) / 30, 2) + maxHeight);
    if (player.Ceiling())
        n = 30 * 2 - n;  // bounce with the ceiling and starts descending with the same speed
    if (player.Floor())  // you have landed
    {
        player.position = Positions.Stand;  // or whatever you want
    }
    n++;
}

// define Ceiling() and Floor()
 


79
General / Re: SetPixel() method throws AccessViolationException (VS)
« on: December 03, 2017, 12:56:54 am »
Hi eXpl0it3r

It seems that you sent your message while I was writting my last one. Thanks. I don't think it was "IndexOutOfRange", ... but anyway, I already solved the issue just removing the "buggy" code.

Laurent

I'll keep in mind to run the debugger before posting ... Thanks

80
General / Re: SetPixel() method throws AccessViolationException (VS)
« on: December 02, 2017, 09:05:56 pm »
Hi Laurent

I removed the code that drew the fixed block to the Image and the app worked fine (it's drawn every loop, no need of SetPixel())

Sorry for the bother

And I like the funny stuff ... Yes, I know debugging, but sometimes it's not so easy in large and sophisticated programs  :)

81
General / SetPixel() method throws AccessViolationException (VS)
« on: December 02, 2017, 07:43:48 pm »
Hello Ladies and Guys

SetPixel() method from Image class throws an AccessViolationException in my poor Super Mario Game, and that had never happened before. I tried to think why it happens, and thought maybe it could be because the image which pixels are drawn to is inside a Texture that is currently in use in the game. But why now, if it had never happened before? The issue occurs when Mario hits a block and it remains out of items (coins, mushrooms, etc), that the program stops drawing the "animated" block and draws the empty hard block (draws on the level image that is in memory) and sets the level hardness attributes of all its pixels to SOLID. And this happens not at the first block, but at the 5th or 6th.

Any help will be appreciated

 

82
Audio / Re: I need Music restarting on an specific offset from 2nd loop
« on: November 14, 2017, 02:18:24 am »
Hi Hapax

I don't understand you perfect at all, maybe cos I´m not English native speaker ... ;)

I understood that I have to add the offset from the 2nd loop ... but I would need to check every frame if the music has reached the end  ... or you mean calculating the number of frames from the 2nd starting and the total length, and just use a counter variable? that would be easier once I have got that numbers ...  :P

And also understood that the ending and the new starting have to concur ... I was cutting back the music files so they become smaller size and tried to make the ending points concur with the beggining ones

In addition, by the way, I have been reading, a few days ago, that some members were requiering new strange and not useful at all features for SFML while questionning the SFML developer and I remember that one of them mentioned SDL like saying that it had some thing(s) that SFML didn't, and I remember also that in another board there was one that rebuked the developer saying something like "are you hiding some bad code and want to keep it hidden, Laurent?" ... I WONDER ... if instead of doing such a lot of that silly stuff, we, the SFML community members, concentrate in requiering features like the one on this post that (I suppose) is really useful, and set aside the silly stuff, I think that SFML would grow much faster and would be even greater than what it currently is

And those who don't like SFML or its developer, or SFML doesn't fill their needs, are not forced at all to stay on it ... but, we ask them, please, to let space for matters and requests that have sense ... cos if they are consented and allowed to keep moving, not further than a few weeks they will request a feature that makes their computers automatically wake up when they do, and say "Good morning" in their own respective languages

83
Audio / Re: I need Music restarting on an specific offset from 2nd loop
« on: November 12, 2017, 06:47:31 pm »
I don't know how to do that ... So I'll have to solve my issue other way and just wait for SFML.Net 2.5

Thanks

84
Audio / I need Music restarting on an specific offset from 2nd loop
« on: November 12, 2017, 06:10:40 pm »
Hello

Is there an easy way to restart a Music from a specific offset from the 2nd loop?


85
General / Re: Please how to do to run my poor SFML game on a 64 bit system?
« on: November 12, 2017, 12:53:23 am »
Yes, I was told to build the .exe as x86 with the 32 bit sfml-xxxx.dll s, but my doubt is the dll s that have to be in the .exe's folder: the csfml-xxxxx.dll s, the sfml-xxxx.dll s, and others (that I don't even know if are necessary), do they have to be 32 bit as well?

I had to install VS in my friend's PC and the game ran fine (all x86 and 32 bit dll s), so supposedly the answer above would be yes? I'm confused, cos I remember having read that one member who has a 64 bit system (was it you, dabbertorres?) had to change the dll s after I change the build to x86 with another game I posted ...  ???

86
General / Re: Please how to do to run my poor SFML game on a 64 bit system?
« on: November 11, 2017, 11:09:36 pm »
May it be that x86 apps run on x64 systems with x86 DLLs?

Sorry for my ignorance

87
General / Re: Please how to do to run my poor SFML game on a 64 bit system?
« on: November 11, 2017, 10:01:27 pm »
I tried to run the x86 app with the 64 bit DLLs (except sfml-xxxx) and it failed, then I tried again to run the game with ALL 64 bit DLLs (including the sfml-xxxx.DLL) and it failed too

I also tried to run the app that I built for x64, with all the 64 bit DLLs and it failed too

88
General / Please how to do to run my poor SFML game on a 64 bit system?
« on: November 11, 2017, 09:47:17 pm »
Hello everyone!

I'm now at a friend of mine's place who has a more powerful CPU, and want to make a gameplay video of my poor Super Mario game, but the system is 64 bit. I have already tried running my x86 app with the 64 bit DLLs and the x64 app with the 64 bit DLLs and both fail. It is Windows 10.

Can anyone tell me how to do? Thanks

89
SFML projects / Re: My last and best Super Mario game version
« on: November 10, 2017, 04:49:47 pm »
Quote
So rather "No, I didn't". ;-)

I thought you referred to the code. I'm not an artist, just a programmer  :P. I think the interesting matter (and challenge) about making video games is the logical diagramming, not drawing  :). Obviously the game's craft is also vital. But that is easy to obtain, a brain that reasons not that much  ;).

Quote
Keep it going, looks interesting.

Thank you very much! ;D

If you would like to see a game where I drew almost all the graphics, you can see "Massacre. A poor 2D Space Shooter" in this same board.  :D

90
SFML projects / Re: My last and best Super Mario game version
« on: November 09, 2017, 06:06:41 pm »
Quote
That looks sweet! Did you make everything yourself?

Thanks!
Yes, I did. The graphics were almost all taken from Internet. I made the code of the game, so as the code of the level editor, and designed the levels.

Now there are levels from 1-1 to 4-6

Pages: 1 ... 4 5 [6] 7 8 ... 15