Tag Info

New answers tagged

0

Your problem statement is not consistent... You say you don't want rectangle corners to cross, so you have check collisions by corners. But when there's a slope, you want your guy to descend the slope, and let rectangle corners cross. The "desired position" rectangle shows this crossing. A solution is to keep checking the corners, and have your collision ...


1

You need to remember that C++ is a multi-paradigmatic (OOP, functional, procedural, ..) language and you should use the programming paradigm that best solves your current issue. OOP doesn't lend itself well to this problem. In OOP you think about single objects in isolation (concept of "a tile"). But most of your algorithms will operate on a whole ...


1

I would advise against using inheritance to manage different tiles. Imagine how annoying it would be having to define a new class every time you add seemingly different types of tiles. That would result in a lot of implementations for simple things like a grass or a dirt tile. It is much simpler and more maintainable to make tiles configurable. Define a Tile ...


0

(I cannot comment so I'm answering) If you build an array with reference for the types of the files (I don't know much of C++, so I'll pseudocode) tiles[0,0] = ref_to_fire_tile tiles[0,1] = ref_to_fire_tile tiles[0,2] = ref_to_grass_tile ... Where ref_to_*_tile holds a reference for a specific type of tile which inherits from a generic one, this way ...


6

It is fine to have lots of instances. An instance of a class without virtual methods is just like a POD C struct in terms of memory consumption which is similar to primitive data types. It is no problem. Your concern when instantiating many instances of a class are resource related I would think. CPU - should not be affected because you will be ...


0

To give an example to my comment public class Tile { //some variable stuff; public Tile() { //some constructor stuff; } } public class FireTile { //some variable stuff; public FireTile : Tile() { //sets player on fire //some constructor stuff ...


0

Here is my suggestion : Create a Class for your Tile, you could have a seperate class for each type of tile (stone/tree/grass) or you could pass in a case to the Tile class that is handled from within the Tile Class which would determine its Tile Type. Regardless of what you do, you need to set up a Bounds property for each one of your tiles. The Bounds ...


0

Some games define rectangular area of the screen that the player can move about in without causing camera movement. Any movement outside of this area will cause the camera to move to compensate. This allows the player to make small movements (e.g. adjusting position on a block or jumping on an enemy) without shifting the camera. Shaun Inman has posted a ...


0

I call the way I do it the rule of the two thirds. Basically the screen height is split in three, and level design is done accordingly to these part sizes. Player avatar is always in the middle part. When she jumps to a higher platform contained in the top third of the screen, the camera moves to center the player. When player reaches the lowest part the ...



Top 50 recent answers are included