Tile System, Cant place 'tower' on certain cell - xna

I've got a tile system in place, and have a few images loading into that, I have it coded so that if the cell is a 'path' then you can't place down a tower, but i was wandering how i would go about making it so that i couldnt place a tower down on more than one texture, or if it would be easier to say that it can only be placed onto a certain texture, rather than listing textures that it cant be put down on?

It will be easier in the long run to specify only the textures that a tower can be placed on, as this way, when you add another type of tile, you don't need to add it to the black-list.
A white-list allows greater extensibility, and easier maintenance.

Related

How can I remove sprites when they are outside viewport, but then add them again if I return to their location to save memory

I'm creating an open-world RPG like Neverwinter nights. But I'm worried about memory and am afraid if I just populate a huge world with physics-based sprite nodes, I won't have any memory for anything else.
To combat this, I want to remove the sprites when they go far outside of the viewport and then re-add those sprites when I get close to their location.
How could I accomplish this?
To any and all who take time to help me with this, thank you!
You can store all data on a database like CoreData with exact parameters you need like states and positions whatever do you need.
Then you can create a method to get all objects on a specific position with radius and use this method when the player moves or when you need to check things like a quest on another site, take those objects and compare with current objects, place again on the correct site the new ones and remove the old ones (they are not on radius probably or disappears for another reason)
This is a complex approach but it could work.

How do I reorderChild sprites without a texture atlas?

For memory reasons I decided to not use texture atlas anymore, I want to load few sprites from file when I use them.
using batchnode, there was a very handy method which is reorderChild that automatically set sprites to front or back depending the axis they are
Is there any feature like that for free sprites? I'm not asking for the algorithm to do that.. just confirming if there is nothing similar to reorderChild out there before get my hands dirty.
Yes, I searched a lot before coming here,
thanks all

What is the general architecture of an endless runner game?

I am confused as to how endless runner games actually work, conceptually, as far as having a never-ending canvas. Sprite Kit is under NDA, so I am going to use Cocos2D as my framework.
There are some tutorials on the web that are specific to other languages, and tools, but I just need to figure out basically: If I create a scene with a specific size, how do I create the illusion of a never-ending background? Do I just animated backgrounds behind the scene, or do I somehow dynamically add length to the scene, so my runner really is running along the canvas?
Do I make sense? I just cannot grasp what the actual method these games use is. They certainly feel like the runner sprite is moving along a canvas, but maybe it's just that he's staying still and all the elements are moving?
One way that you can make the "endless" environment is by making UIViews (or NSViews depending on what platforms your game will be available on) that contain only a section of the environment so they can be reused when the runner passes that part of the game. Each view can be dedicated to display a certain feature of the game such as a power-up or an obstacle and it will be up to the logic of your game to decide when to use each view.
Lets think of endless runner like jetpack joyride.
You might want to have two background nodes, each larger than the screen size by some amount (maybe 1.5 or 2 screen widths).
When you load your level, you load first background and add second background at the coordinates where first ends, so that they form long screen. Then when we start moving character along this background when first background leaves screen we can take it, and change its coordinates to those where second background frame ends. This way when this comes to an end, we do the same with it.
This way only using 2 long images we can simulate essentially endless space.
You can use longer sequences for your game.
You can add other nodes to your background when it has left the screen and present it, so it looks different each time.

Picture overlapping program

I have a set of images and they overlap one another.
So if I were to put them together I would have a single larger image than any one of them, and it would show me the "full picture". It could be used for a set of images for instance, that would make a full panorama.
I can do this by hand, but then.. that's quite some work.
Is there any freely available program out there that does this?
Especially one that is free of charge and with relaxed license restrictions and works on Unix?
I have tried googling it to no avail and I have checked through ImageMagick's functionalities and haven't found this there.
The main work in a functionality like this would be to figure out first how the images need be put together in order to make a single coherent image.

Composed animations, sprites in iOS

let's say I want to display a customizable (2D, cartoon-like) character, where some properties e.g. eye color, hair style, clothing etc can be chosen from a predefined set of options. Now I want to animate the character. What's the best way to deal with the customization?
1) For example, I could make a sprite sheet for each combination of properties. That's not very memory efficient and not very flexible, but probably gives the best performance.
2) I could compose the character from various layers, where each property only affects one layer. Thus, I could make a sprite-sheet for the body, a collection of sprite-sheets for the eyes (one for each eye color) etc.
2a) In that case, I could merge the selected sprite-sheets in order to generate a single sprite-sheet containing the animation of the customized character.
2b) Alternatively, I could keep the sprite-sheets separate and try to animate them simultaneously as layers. I fear, that this might become a problem performance-wise.
3) I could try to modify the layers programmatically, e.g. use a sprite-sheet for the eyes as a mask and map some texture on it before merging it down to a single sprite-sheet. I would think this is a very flexible approach when it comes to simple properties like eye colors, but might become difficult for things like hair-style. I am aware that this depends much on the character and probably a general answer is difficult.
I assume that my problem is not new, so there is probably a standard approach to it.
Concerning the platform, I'm particularly interested in iOS and try to avoid OpenGL (well, I'm open-minded). Maybe there is a nice framework that can help me here?
Thanks!
Depending on what your working on, you might want to animate part/all of the animations outside in another tool, such as flash. It is much easier to work with a visual environment.
Then there are tools that take swf files, and create sprite sheets that you would then animate in cocos2d.
That is a common game creation workflow.
You problably want to take a look on how to create sprites at cocos2d.
Cocos2d comes with a set of tools that help you to animate single parts and offers abstractions to compose parts (like CCBatchNode or CCNode). Also, it comes with tools that helps you to pack sprites into sprite sheets (e.g Texture Packer) and develop levels (e.g Level Helper).
Cocos2d is an open source framework and it is widely used. You also have cocos3d but I never used it :).

Resources