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] 2 3 ... 15
1
General / "AccessViolationException" when my game ends, SFML.Net, C#
« on: October 06, 2020, 10:33:17 pm »
Hello Ladies and Guys from SFML

My "wonderful" game I'm currently working on (about Super Mario Bros. - much better than before ones) throws an AccessViolationException when I quit the application. I'm using SFML.Net, C#, on Windows 7 64 bit.

Could someone tell me what could be the causes of this, on what SFML is concerned? I think the cause must be an SFML object. The Debugger doesn't show me the part of the code that produces this Exception.  :(

I'll be posting the game in the projects forum when I finish designing levels ... and solve this issue.  :)

Thanks in advance
Pablo
PS: Note I didn't use the word "poor".  ;)

2
General / Re: How to create a point and click mechanism
« on: January 27, 2020, 10:54:22 pm »
Hi Stuff

The idea is the same, when you click, you would need to get the mouse (x, y), then you would need to make the player just go to that point, and the way to do that is the same, with angles and trigo functions. This, if you want to make the player go in a direct way (oblique), I mean, not going like squares.

Another thing I would add is to check when the player has reached the point, and then make it stop.

And what about if you click again before it has reached the point?

3
Feature requests / Re: Friendly string mapping to Keyboard::Key
« on: January 27, 2020, 04:03:09 am »
Hi Rosme

Please, read my post again. Did not you understand my irony/joke?

Have not you read when that character, "phanoo" (if I remember correctly), prompted everyone to switch to SDL because SFML did not support Clippboard? Remember that? And now there is also people who say "I'm moving away from SFML because "it does not support 'The Universe' "", this is more current, do you remember?

Well, I based my irony/joke on those circumstances. Actually, I did not think that I would have to explain this, ... but well, everyone can be wrong sometimes!

I know very well that neither SFML nor anyone need my defense, but, please, Ladies and guys, forgive my little joke, please! It just comes from my soul to say, in a way or another, how useful and nice is SFML(.Net) for me.

And yes, obviously you are right, everyone is free to use whatever she/he wants. I was just kidding!

Kind regards,
Pablo

4
General / Re: How to create a point and click mechanism
« on: January 22, 2020, 07:54:55 pm »
Hi Stuff

If you want the player to run after the mouse cursor, then you can do this (on every frame in your main loop):

int x = mouseX - playerX;
int y = mouseY - playerY;

double angle = Math.Atan2(y, x);   // I don't know if in C++ it is std::atan2(y, x);

double playerStep = 5;  // or what you prefer

playerX += Math.Cos(angle) * playerStep;
playerY -= Math.Sin(angle) * playerStep;


This would make the player run after the mouse cursor. I don't know if any sign (+/-) is wrong, I always get a bit confused with angles, but if it is, it is just that.

5
Feature requests / Re: Friendly string mapping to Keyboard::Key
« on: January 22, 2020, 07:29:16 pm »
Hi, Ladies and Guys

What about the ToString() function from the Keyboard.Key class or enum?

I use SFML.Net, and as I have all the Keys, so there is the ToString() function which gives them as a string. Actually I made a Keyboard Input Selector in one of my games and I see, while selecting, all the availavle Keys as strings in each selector box.

Maybe this is not possible in C plus plus? (Sorry I don't know)

On these days, that there are some people that say "I'm moving away from SFML because .... (it doesn't support "the Universe") .....", and also I remember not so long time ago there was a guy (phanoo, if I remember correctly) who prompted everyone "to switch to SDL because SFML didn't have Clippboard support", I would say to all of you, MODESTLY, ... -"Please, move away from SFML, but to SFML.Net!!! You will avoid more than one issue. Switch to SFML.Net!"


6
General / Re: Text
« on: December 31, 2019, 08:57:11 pm »
Hi

If you want to write the text during the game, then you should draw the text object every frame, into your main loop, and you can also add a condition if you want

while (true) {

.....

text.setString(score.toString());

window.draw(text);

........

}


7
Thank you very much for your time, G.!

My error was that I added a 5th Vertex to the quad

You solved my issue


8
I saw in another post in the forum that Laurent said that texCoords are like a Sprite's TextureRect ... I have no doubt he's right, but I can't understand how ...

The TextureRect is a Rectangle which has a Vector2f Position and a Vector2f Size, like ( (x, y), (width, height) ) ... but, as I have Quads in my VertexArray, then I have 4 Vertices and then 8 numbers ... those 8 numbers, what should they be?

I want the Texture, which is 80x80, covers al the parallelepiped's faces (the 3D buildings), the faces are Quads

I will apreciate very much if someone solves my mistery  :)


9
What should they be? I put the same coords than the Quad's vertices and it is still the same ... just the old colors but darker ... I can't see the texture in the parallelepiped's faces ...

Thanks for replying

10
General / How can I assign texture to 3D buildings made with VertexArrays?
« on: December 18, 2019, 07:48:43 pm »
Hello ladies and guys!

I would like that Quads (that are the 2D parts of my 3D buildings) have a texture, so the 3D buildings look a bit more like buildings ... I tried this but they just show the same old Color but darker

        private void AssignVertices(VertexArray array, Color color, float[] coords)
        {
            int a;
            array.Clear();            
            for (a = 0; a < coords.Length / 2; a++)
                array.Append(new Vertex(new Vector2f(coords[a * 2], coords[a * 2 + 1] + this.ship.Scroll), color, new Vector2f(0, 0)));
            array.Append(new Vertex(new Vector2f(coords[0], coords[1]), color, new Vector2f(0, 0)));
            RenderStates states = new RenderStates(Graphics.building);  // this is the Texture
            this.window.Draw(array, states);
        }
 

Maybe those who remember my Massacre space shooter game will understand better ...

Thanks in advance
Pablo

11
General / Re: Space Invaders - Enemy Movement Logic
« on: November 21, 2019, 05:57:16 pm »
Sorry, I'm a C# programmer, I know very little C++

Maybe if I saw the entire code (and if I had the C++ compiler) I might find out ... but surely any C++ programmer here will tell you what is wrong

But check the array, or list, or vector's size ... did you allocate it for containing NUMBER_OF_ALIENS?



12
General / Re: Space Invaders - Enemy Movement Logic
« on: November 21, 2019, 12:46:19 am »
Hi firepro20

I called, in my "Massacre Space Shooter", XRadius and YRadius to half the width and height, respectively, of any ship. So then you can check collision, reaching the bounds, and also if bullets have touched a ship. As I saw in your code, your enemy's XRadius would be 24.

Yes! I'm sure it would be a good practise to make a class for each different enemy, and then a "collection" class for groups of them. Also you can write an abstract class to put there all enemies' common attributes and methods and then make all enemies inherit from it.

13
General / Re: Space Invaders - Enemy Movement Logic
« on: November 18, 2019, 01:18:39 am »
Hi firepro20

Basically it depends on how you want your enemies to move. They should have X and Y variables to set where they are, Sense (1 if going right, -1 left), Health, Points by destruction, some object list for weapon, maybe SenseY (for up/down), etc. If I understood well the movement you described, it would be like

//inside your enemy update code
X += 3f * Sense; // goes from side to side through the screen
if (X >= SCREEN_WIDTH - 24 || X < 0 + 24)  // you could use XRadius instead of 24
    Sense = -Sense;  // has reached bound, then goes oposite
Y += 1f; // just goes down screen

Then you would have to check if player (space ship) shoots have touched the enemy, if it collides with player, or if it goes off side and then disappears, etc ...

You can also make curve movements, for which you would have to use, generally, sine and cosine functions, and sometimes also arc tangent

Continue with it, your graphics are very good
And please come back here if you need any more help
Pablo


14
General / Why my SFML.Net 2.2 game makes Windows 10 restart?
« on: August 12, 2019, 09:39:04 pm »
Hi all

I'm trying to run my SFML.Net 2.2 game on Windows 10, but it makes system reboot.

What could be the causes? It doesn't seem to be the drivers. Neither the antivirus.

Thanks
Pablo

15
General / Re: Wrong Screen ratio
« on: July 17, 2019, 12:50:38 am »
Hi all

eXpl0it3r:
On my notebook's monitor I didn't have that issue, but as in other ones I did, I would like to have the same code in my project, and, supposedly it would work fine even on those monitors that don't distort the aspect ratio

I have just tested in a 1440x900 monitor and it doesn't work either

This is my translation of the function from C++ to C# ... maybe there's something wrong

        public static View getLetterboxView(View view, int windowWidth, int windowHeight)
        {
            // Compares the aspect ratio of the window to the aspect ratio of the view,
            // and sets the view's viewport accordingly in order to archieve a letterbox effect.
            // A new view (with a new viewport set) is returned.

            float windowRatio = windowWidth / (float) windowHeight;
            float viewRatio = view.Size.X / (float) view.Size.Y;
            float sizeX = 1;
            float sizeY = 1;
            float posX = 0;
            float posY = 0;

            bool horizontalSpacing = true;
            if (windowRatio < viewRatio)
                horizontalSpacing = false;

            // If horizontalSpacing is true, the black bars will appear on the left and right side.
            // Otherwise, the black bars will appear on the top and bottom.

            if (horizontalSpacing)
            {
                sizeX = viewRatio / windowRatio;
                posX = (1 - sizeX) / 2f;
            }
            else
            {
                sizeY = windowRatio / viewRatio;
                posY = (1 - sizeY) / 2f;
            }

            view.Reset(new FloatRect(posX, posY, sizeX, sizeY));

            return view;
        }
 

Thank you all for your help

Pages: [1] 2 3 ... 15