I am completely new to the world of 2D engines. I figured out how to upload images and display them as sprites and stuff, but there is one question that bothers me. For example, when a "rocket" hits an object, it deals damage to it and leaves the crater behind. I would like the crater to show at this facility. This will require skipping some pixels of this image when rendering, right? My question is: how would you do this? What information would you use to save this? How to display a "broken" sprite?
Create a sprite sheet .
, . , , ..
, , . , . , , X Y . , , , , .
. , .
, XNA, , API ( OpenGL/D3d ). , RenderState. RenderState , ( AlphaSourceBlend AlphaDestinationBlend RenderState, , ).
RenderState
AlphaSourceBlend
AlphaDestinationBlend
, RenderState GetTexture().
GetTexture()
, , SpriteBatch "" ( XNA, , ), reset .
: http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Adding_craters.php
, , , .
public static void Fill(this Texture2D t, Func<int, int, Color> perPixel) { var data = new Color[t.Height * t.Width]; for (int y = 0; y < t.Height; y++) for (int x = 0; x < t.Width; x++) { data[x + (y * t.Width)] = perPixel(x, y); } t.SetData(data); }
- Java-, / ( GunBound).
, . , . , , blitting transparent hit testing.
, " " .
, , . , , .
Source: https://habr.com/ru/post/1736285/More articles:Best way to generate a unique identifier in java - javaSafari and z-index problem - safariEscaping characters in Objective-C on iPhone - javascript64-bit equivalent class for wmi class "win32reg_addremoveprograms"? - windows-7Custom LINQ Implementations - linqОшибки API Facebook с "Недопустимый или недействительный ключ сеанса" - c#Problems with validates_inclusion_of, actions_as_tree and rspec - ruby | fooobar.comHow to add 3 images to a canvas in android - androidCan this be done in one request? - sqlJava field validation engine - javaAll Articles