Tag Info

New answers tagged

1

It's because of the variable IsOnGround and duration of jump key. Imagine this, no matter how fast you are. Update will be called 60times a second. That makes jump key true for more than a instance. Also it takes player time to achieve lift off making isOnGround true for more than one instance . Hence the inconsistent jump, try switching isOnGround to off ...


0

You could use a different approach for your list. Linked list. where each item hold a pointer to the next item in list. Insertion and removal cost is O(1). This is not cache friendly though, but you can try. Better sorting methods, e.g. if you use a bubble-sort, you can pick a much better algo that suits your case better (single insertions/removals don't ...


2

The answer to this question here should help explain how to use the GetData function. Basically, the data is stored in the return array from the GetData call is formed by reading the 2D texture from left to right, top to bottom, transforming it as follows: AAAA BBBB => AAAABBBBCCCCDDDD CCCC DDDD To determine where a given pixel in the 1D array is, we ...


1

Though Fault's comment is correct, what I usually do is to store the rotation and translation and then recreate the view matrix when required. (Full article here). The gist of the idea is: (btw the type of camera you are creating is often referred to as an Arc-Ball camera.) public class ArcBallCamera { public ArcBallCamera(float aspectRation, ...


1

When you starts going upwards you can start counting X from 0 to 90. For example you can increase X by 1 every 16 ms (for example). Then you can use X to use appropriate shipX frame. When you stop going upward then decrease X from current value to 0 (for example 2 by every 16 ms). Then the ship should back to its prime position softly.


-1

Use ccsprite with ccbadgenode in order fire number of frame of spite with moveto postion can change each frame interval with time .cccallfuntion is -(void)playStarAnimation { Animation *anim = [Animation node]; sp = [anim playAnimCCSpriteWithFileName:@"STARS~ipad" frameName:@"STARS" Layer:physicsLayer From:1 To:42 Delay:1.0/20.0 Loop:4 ...


1

Is there a way I could speed up things? No, there isn't. The slowest part of your system is the time it takes for the image to be displayed on the monitor, which presumably is in the vicinity of 24 milliseconds. (The monitor takes 16 milliseconds to draw the frame, plus 8 milliseconds because on average the monitor will be halfway through drawing a ...


0

From what I know the fastest way to render something in SDL 2.0 is using textures. You can use SDL_BlitSurface so you don't need to use renderers and convert to textures but that is slower and it is also a bad habit to use it. I would say to stick with textures because it is probably the fastest way to do it. Plus that it is also not so much harder to use ...


2

Add a flag to determine if the player has been stopped. At that point, stop setting the players position to the camera's, and instead some other input. public float speed; public test testing; bool stopped = false; // Use this for initialization void Start () { speed = 10f; testing = Camera.main.GetComponent<test>(); } // Update is called ...


0

With just a couple of slight rearrangements, you could have: float a = (transform.position.x - Camera.main.transform.position.x) * Main.scale; float b = (transform.position.y - Camera.main.transform.position.y) * Main.scale; onscreen = a > -width && a < GameView.width && b > -height && b < GameView.height; It will ...


1

Keep an "on-screen tiles" collection that you update each time the camera moves and each tile has a reference to the objects in it. This was you only need to update the objects referenced by the tiles that are on screen (or just outside).


4

You should be using layers. That is you have a naked character sprite. On top of that you add layers for hair, armor, gear, weapons. Depending on your actual game, you might do that in generic form, or split in parts or even add skeletal system. For example in Diablo 2 character was split into parts that were combined: Here's another example of ...


12

Yay I found a research paper! In terms of computational cost Shadow Mapping seems pretty clear winner. Algorithm used can be found here and a C# implementation can be found here, relevant bit below. #region FOV algorithm // Octant data // // \ 1 | 2 / // 8 \ | / 3 // -----+----- // 7 / | \ 4 // / 6 | 5 \ ...


2

In order to create a randomly procedurally generated level, you need a random moving unit AI that behaves like the player. The computer controlled unit needs all the moves (actions) the player would have at this point in the game and it will need to refrain from heading back (I'll explain why and how next). You need to mark each platform and each empty ...


0

If you want it to be a realistic representation of an intelligent agent avoiding an obstacle, then I would suggest a different (more representative and general) kind of model. When the agent first enters the situation, have it plot a course to the target, and check whether the course will crash into anything or not. If not, then it can follow that plan ...


0

Anko and ashes999 were both right. (See their comments to my initial question) All my problems built upon my misunderstanding of spriteBatch.draw()-API. As soon as I got the right block size in place and adapted the camera to this new stuff all my problems were gone.


0

This effect is likely done with blending modes. http://blogs.adobe.com/webplatform/2014/02/24/using-blend-modes-in-html-canvas/ You would create a gradient light texture like: and set the composition/blending mode to either additive or multiply (or some other mode for a different effect) and then draw it on top of the area you want lit up. I'll see if i ...


23

One of the best, and most used, algorithms I've seen out there is generating dungeons using Binary Space Partitioning. The best general explanation I've read is the one found in The Chronicles of Doryen (attached at the end for backup purposes) because explains the procedure without getting into the code, thus leaving the implementation to the reader. Two ...


0

You can't do that with physics very easily (if at all). A much simpler solution would be to use a second camera and calculate the viewport. The psuedocode would be something like: if(magnificationCameraGO.IsVisible) magnificationCamera.enable; magnificationCamera.pixelRect.x = ...


1

What I've used among personal projects and projects for clients (when I'm part of a team that has dedicated artists) is a workflow similar to this one. Maybe there are obvious steps, but that's the pipeline. Create the character first draft (to put a name) and preferably work everything on layers (e.g. Photoshop layers and layer folders) Define the ...


0

What I would to is set a key to show the hit box. I tend to use F1 and that way when I hit the F1 key all my hit boxes show up as red. In order to get that to work you would create a 1x1 blank texture and : In LoadContent: content.Load<Texture2D>(@"1x1");//or replace 1x1 with where you put the image In Update: KeyboardState ...


-1

Your image looks like texture. The most obvious way of using it is to map to polygons of model. In your case it is 2D planes with textures on it. They can be layered like paper doll and dresses. So, you need to create texture image first and then map its parts to polygons Read more about texture mapping


2

Data structure Vector of vectors (a.k.a. array of arrays) Using this data structure allows you to consider vertices and edges (specially useful when dealing with one-way streets or roads) and it also let's you consider more efficient maps, leaving out obstacles. In this case you would use at least two vector of vectors; one for storing the vertices and ...


0

This looks like texture wrapping. Click on the texture, open the texture inspector, and set Wrap Mode to Clamp.


0

I've opened the sprite from my Assets folder into photoshop. there was no border. I cut away the offending borders (which made my sprite into a 69x69 instead of 70x70). this seems to have solved it for now. if anyone has a similar issue and finds a better solution, please do post.


1

I'll refer to map nodes as tiles for the purpose of explanation, but the principles are the same. If you have more than one node in an area, then your "tile" would contain an array or list of nodes. For all of these, graph theoretic applications can be applied, though the method of application becomes more or less complex depending on what specific algorithm ...


6

Basically, I think what you do is first of all create a tile for each of your terrain types that seamlessly tiles with itself. As you said there are many tutorials available on how to do this. Once you have those tiles, you can draw variants as well as transitions between different types of terrain by modifying copies of them. The only thing you need to ...


0

Metaballs is a good way to think about solving this problem. It's usually the way that people develop implicit surfaces using particle-based fluid simulation like Smoothed Particle Hydrodynamics. There have already been a few questions asked about how to render metaballs: How to render metaballs? 2D metaball liquid effect - how to feed output of one ...



Top 50 recent answers are included