3D gimmicks on 2D

I wasted my last 2 days to do flip card animation.
Well I made it by creating a look exactly the same as the 2D uses. (and the same cordinate system).

Basicly i draw a Texture2D, when i start animation stop drawing it and start drawing same texture at same position with VertexPositionTexture ,do the animation at finish stop drawing Vertexs and go back to drawing Texture2D.

Well my question is ,is there actually a basic or better way to do this? Any shortcut to get the same look that normal 2d drawings using?

Well, you might draw the card-image in a rectangle…
Then, in update, when you want to flip the card, you subtract ‘2’ from the width of the rectangle, and add ‘1’ to the x-position until the rect. is narrow enough to be just a line…
Then you switch the texture drawn to the back of the card,
and re-expand the rectangle…

Its only 2d, but its so easy to do… Even for someone new to monogame, I think…

Alternately, you can scale your sprites using a vector2 instead of a float, so you would just scale the x-axis down and up again… (switching textures in between)

Well i tried scale with Vector2. While it is good for simple animation not good enough to make the dept ilusion.

While scaling down there must be a way to narrow 1 side of the rectangle or draw triangles like 3d vectors to give that dept ilusion.

Or a command for 3d to use 2d camera and draw at Z=0.

Thats true, there is no depth illusion… But it IS a cheap and easy way :slight_smile:

…And if you don’t want to do old-school animation (would be easy with gimp, its free and has a perspective tool, but might require some time to do all the cards one by one)
all I can think of that is fairly simple, is using VertexPositionTexture… I have only used VertexPositionColor, but I gather i works much the same…

Heres a reimers link I think explains it. Yup, I would choose this one… Seems nice.

Or, you could “take a deep breath” and venture into 3d, with textured models for the cards, and you can just rotate them along any axis… That might even be a good little project size for getting INTO 3d…

Thanks for answers, I do not need 3D for my game logic so no need to go in 3D world for now. I did this because i am not an astist so drawing multiple textures in gimp at this point would be loss of work time.(Well much more then 2 days at least, i am that much bad at art : )

I just do not understand what i do is not a deafult implementation for monogame.

I use vertexpositioncolor for 2d, to make polygonal shadows…

I really think what you need, is VertexTexturePos…
That will give you the trapezoid shape you want, with any texture…

It will work for 2d just as good as 3d, and you dont have to setup anything except for coordinates and textures…

Dont worry about all the advanced 3d concepts, and matrices etc… You wont need any of that…

What exactly is your goal and what was not good enough when just scaling? What does your current solution have in terms of depth illusion that you couldn’t manage with scaling? I mentioned this in the thread you linked, but it will look better if you don’t make the transition linear. You want the rotation to be linear, so if you use scaling to give the illusion of linear rotation you need to apply a sine function to your interpolation value.

Well i can’t give screenshots because PrintScreen takes my game menu screen instead of Gameloop (Using gamestates).

So here an artistic view of what i am doing. Will sell the painting for 43.2 million dolars : )

That green shape you have is called a trapezoid… As I stated above, I really think the tool you are looking for is VertexPositionTexture…

This will let you draw any shape, and CHANGE the shape dynamically… You dont even need to do anything 3d… You just move the corners by changing their coordinates…

Here is a picture of how I use vertexCOLORpositions in 2d:


Notice the black shadows on the wall… This is what you get with vertexColorPositions, but using vertexTEXTUREpositions, you can have the same kind of thing, only textured…

I think i am already doing that. My code is too messy to paste( will just waste your time) But i am using VertexPositionTexture[] and BasicEffect . I just dont get how you can easliy adjust the camera. Maybe i just struggled to much because i am a newbie.

No problem… You dont need a camera for this :slight_smile:

Only, instead of screen coordinates, like (800,500),

there is some other coordinate system, I think with (0,0) in the middle and -1 and 1 at the extremes…

Oh, I see. The easiest way to do this is what you’re doing right now. No shortcuts. I think you can achieve this with the SpriteBatcher in Nez (https://github.com/prime31/Nez/blob/master/Nez.Portable/Graphics/Batcher/Batcher.cs). It allows you to skew your sprites as well as everything that the MG SpriteBatch can do.