nimos100's Recent Forum Activity

  • [quote:344c85pd]You wouldn't want to take a look, huh? I end up with way more than 8 corrections, but maybe I'm over complicating it. I start to "get it" but then it stops making sense when I get around to implementing it.

    After doing an example I think you need 12 in total to make it work. Here is how I would approach it.

    If we do an internal correction of the tiles, meaning that we replace the actual farming tiles with the correct ones, it could be like this:

    Which will work fine if the farming area is a minimum of 9 tiles. But that is not going to be very flexible and it doesn't work well with different shapes.

    In this case all single tiles will cause some problems and would create some weird spikes in the farming plot. So instead we can do an external correction. Indicated by the blue dots. So if we start making all the horizontal and vertical corrections (Top, Bottom, Left, Right). We would end up with something like this.

    Next we do it for the outer corners which again requires 4 corrections. (Top left, Top right, Bottom left, Bottom right) and then we would end up with something like this:

    So last we need the inner corners, in the screenshot there are only 3 dots, but obviously you need 4, but its just not in this shape. But again it requires 4 corrections (Inner top left, inner top right, inner bottom left, inner bottom right) and then you would be able to make any shape needed.

    So I would approach it like that, split each correction up into these categories. And just focus on 1 of them at the time, and don't worry that it doesn't look correct until all of them are made. And just work on one shape all the time until it looks correct to avoid confusion. And when that shape is working, then try to make some other random shapes. Because even though I say that these 12 correction will allow you to make any shape, it actually not true

    The moment you get a shape like this, then it wont work anymore.

    So you need to find some way to handle situations like that as well. But if you focus on all the problems at once, I think it will be very confusing.

  • I know the basics, but was hoping there was something already done to make this an easier process. It's driving me nuts trying to do it alone, but what I'm trying to accomplish is for a character to "farm" land, and the border of the land to auto-fill with the proper border. The closest thing I can think of to this is the way RPG Maker handles putting land on water or vice versa. What is this called?

    BTW: This is the current "farming" tiles I'm using. Is this the proper format (enough images, that is) to "auto-tile" the borders?

    Think I mentioned this in the other post, as soon as you have stuff that are bigger than the tile size then it starts to get a bit complicated

    I don't think there are any other way than to make it so you check the surrounding tiles and correct them. I used a similar method in my Random dungeon generator tutorial - https://www.scirra.com/tutorials/999/random-dungeon-generator-node-based#h2a13 - Step 9, this is ofc a bit different as I work with hallways, where there are certain limits to how they can be arranged, where I guess the player in your game could make the farming area whatever shape they like. So in your case you would need 8 corrections I think, where as I needed 4 because of there being no directional corrections needed.

    However what you can do is start by placing a square farm plot on the map using those tiles that are just dirt. And then you add functionality that corrects these, so it create a border around that. When that is done you should now have the ability to correct Left, Right, Top, Bottom tiles. So you create a new shape maybe one that is in the shape of a horseshoe and again you try to see how you can correct the borders on that one. And you just keep doing that until you have all the stuff you need to make any shape. Doing it like that will make it a bit easier to see where bugs occur and what tiles still need to be corrected as you work.

    But it seems that you have most types that you need, might lack 4 tiles for turning but if you do it like above and just build the shape in design view it should quickly show whether that's the case or not.

  • it took me a while to exactly understand what you wrote... and on second thought i have to go with my aproach. i want to use the instance variables, as i need more values than just the description. and it seems to be "cleaner" for me if i dont define all that over the actions but in the instance variable for the objet itself

    let me know if i am wrong here...

    regards

    patrick

    Think my last post answered it

  • [quote:11ug9sfx]still not perfekt, but i can work with this for now, thank you very much

    i am missing something like a simple mysql database... i would like to pull those values from a database as i plan to implement much different objects.

    i have a basic knowledge of mysql and php. so my longterm goal is to make an multiplayer game with an ongoing economy... but that is far from now

    i will look into that in a few weeks

    That's good

    However I would strongly suggest that you read this part in the manual about families, before you continue to much. Especially if you plan on making a big game, without understanding this correctly you will eventually loose control of the project and run into some really weird problems, that will be very time consuming and difficult to fix.

    From your screenshot and being satisfied with the solution you got its pretty obvious that you didn't really understood what I tried to explain. As you would need to add one line to the "On tap gesture on RadarObjects" to make it work for all the objects, if your setup was correct.

    To give you an example as of now you have added 3 separate "On touch" which basically does exactly the same thing. Now imagine when you expand your game to maybe 25 different objects, then you would need 25 of these events, but also you would need it for all other event that would involve these objects. So soon you will spend so much time copy/pasting and correcting stuff, that you will hardly make any progress on the actual game. Trust me I did it the same way as you did when I started, so to save you some time I again would strongly suggest you to read and really understand how families works

    Families

    https://www.scirra.com/manual/142/families

    [quote:11ug9sfx]

    i am shure this wont be my last question i have to ask here

    I might cash in on that beer some day

  • [quote:31332ceb]This wouldnt make sence since every object has its own discription...

    Yes but you want to be able to set and get the description right?

    [quote:31332ceb]..so even if i have a family for spaceships the description is never the same... (i am thinking while writing, sorry) so i have to find a way to display the discription of a specific selected object. i have to rethink my aproach here...

    Here is an simple example of how to do it.

    Each square illustrate a spaceship of different type, called "Spaceship_1", "Spaceship_2", "Spaceship_3". All of them are also part of a family called "Spaceships".

    This family have 2 Variables:

    "Description" (By default this is empty)

    "Type" (The purple square is Spaceship 1, Green Spaceship 2, Red Spaceship 3)

    To set an individual description for each of the spaceships I can do the following:

    Depending on the type of spaceship I click a description is written. So if I click spaceship 1 it will set the description for that spaceship to "This is spaceship 1" and so on.

    Since I have added the variable to the family I can access it for all the spaceships and set it individually for each of them.

    If I wanted to set it for all of them at once I could do it like this:

    In this case whenever I press a spaceship, I don't care which type it is and just make it so all spaceships get the description "This is a spaceship".

    Again this is because I added all the individual spaceships to the same family. So as you can see there are no problems selecting a specific spaceship or all of them at the same time.

    Also as mentioned earlier because I have added the variables to the family and therefore they are inheritance by the members, I can still access them through the members. So this example will also work without any problems:

    The purple square doesn't have a variable added to it called "Description" besides the one that comes from the family.

    So regardless of how I choose to work with the objects or the family I have access to the variables and can manipulate them whatever way I want.

  • Hey nimos100, Thank you so much for helping me out here

    Np

    [quote:2q5k0x76]1) yes, the values are different for each object but each object has the same variables... so i thought there is an easy way to just say give all those objects the instance variable "description, shield, firepower" and then enter each value manually without having to create each instance variable for each object manually as they are aleways the same.

    If you create an object lets say "Asteroid" and you give it a variable, such as "Asteroid type" this is added for all asteroid objects and can be set at design time to something default lets say "Iron ore".

    Whenever you create an asteroid it will by default be this type.

    If you add the asteroid object to a family, this variable will not be available if you use the family to select the asteroid object.

    And from your screenshot it seems that this is what you are trying to do.

    [quote:2q5k0x76]"Set text to RadarObjects.description1"

    But looking at the asteroid instance variables there are nothing called description1, but something called description. Which I assume is the one you would like to use?

    Variables that are added to a family is shared by all objects in that family, but variables added to specific objects are not available to family objects, even though they are part of the same family. Which makes sense because if you besides having an asteroid in your family also had a spaceship, it wouldn't make much sense if this had an "Asteroid type".

    So to me it seems like you have mixed up family variables and specific object variables. So to fix It you have to use only the description from the RadarObjects as this is shared amongst all the objects in the family and then remove the description from the specific objects.

    Then you will also be able to give all objects that are the same in the family a default value, so for instant if "Asteroid" and "Spaceship" are in the same family and you have a description variable. You can in design view set Asteroid description = "This is an asteroid" and for the spaceships set it to "This is a spaceship" and this will be the default value for all newly created spaceships or asteroids.

    Hope that makes sense, know it can be a bit confusing?

    [quote:2q5k0x76]2) got that but actually i will show the description from the object in the hud... but i cant get the variable "description" from the object, just from the family ...

    Pretty sure this is due to the above problem.

    [quote:2q5k0x76]Maybe i can answer my own question... it seems to be not possible, i should use some kind of 2D array, as the dictionary only supports 1D... am i right?

    Dictionaries are 1D, but I don't think you should jump into arrays as they will not solve the problem and is not needed in this case anyway.

    As I see it you mix up what different types of objects are and therefore might be confusing yourself a bit

    If you have a "Man object" and a "Women object" these are not the same obvious, if you add both of them to a family called "Humans" they are still different object, however now you added a family object as well, and this object is also a different object than the Man and Women objects as its a Human object in this case. So in theory you have 3 objects.

    The benefit of the family object is that each member of the family inheritance the family variables and can make use of them. So in this case whether you are a man or a women you have an age. So you can add an "Age" variable to the Human object and then both the man and women object can make use of it. Using a family also allows you to work on all members of it. So if you wanted to select all humans that are 20 years old. It will select all humans, men and womens a like that are 20 years old, instead of you first having to select all women that are 20 years old and then all men as well. However a women can be pregnant but a man cant, so it wouldn't make much sense to add a variable to Humans called "Is_pregnant" for instant so this you could add to the Women object instead, and then its only available to Women.

  • Yeah, I just want to make sure everything lines up properly. I was thinking I should find a way to determine which 32x32 square my character is standing in, that way I can specify where to place the "changed" block. I might find myself with 32x32 background tiles, and change them as the player uses said tile.

    I'm open to other options, too. I'm not wanting to get too complicated, as I like clean code.

    Lucky its fairly easy to work with tilemap, here are some tips to get you started

    First thing is to keep track of tiles, since C2 doesn't show the tiles for you, adding a functionality that will always show this based on the mouse position is very helpful (The purple square is the mouse position). And in a lot of cases when working with tilemaps I personally find it a lot easier to work with the tile index rather than X,Y coordinates as it can be difficult to see what tile you are working with. So storing the converted mouse X,Y position in a variable can be useful, I would normally store these in a Game_controller sprite rather than as global variables, but either way will work. Storing these values can make it easier if you need to select tiles, as in the second event I use these variable to set the target tile for the green sprite or if you imagine that you want to check if there is a certain thing on a given tile.

    In the last event I store the units position in two variables.

    Tile_X and Tile_Y and you just have to make sure that these are always kept up to date and then you can use these whenever you need to check if a unit might be overlapping something on a tile etc.

    And I would add such conversion to all objects in your game, so you can just do a Object1.Tile_X = Object2.Tile_X and so on.

  • In short yes I would think so

    However when using tilemaps you have to take into account if things you want to add are bigger than the tile size, then it can start to become a bit difficult, as you would have to split the objects up in several tiles and make sure that they are loaded correctly. Meaning that they doesn't suddenly overlap other objects that they shouldn't. However if you plan on making a big game, then I would go for it anyway. If you plan on the player not being able to do a lot of things at the same time, for instant dig 1000 holes in the ground, then a mixture might be easier. So the background is a tilemap, but holes etc are just sprites added on top.

  • [quote:1ivt8s2f]1) Is there a way to easily insert all those values for all objects in a table style or do I have to create every instance variable for every object manually even if it is from the same type? I tried to copy paste them, but with no luck.

    Its a bit hard to see what you want to do on the screenshot, but if I understood you correct.

    If the values you want to set are individual for the objects then you will have to do it for each of them. However you can do it using a "for each" or some other loop to do it faster.

    But can you try to show a screenshot of what exactly you are trying to do, because what im saying might not be what you are after.

    [quote:1ivt8s2f]2) As you can see I have grouped the objects in a family. Now that I want to show the description I must select the instance variable from the object which is selected. But I can only access the instance variables of the FAMILY how can I get the variables from the selected object?

    Am I doing something wrong or is my whole approach to do this wrong? The select and target the selected object works pretty nice… so I would like if I could get the description to work. Also a database style workflow would save me so much work creating all those instance variables.

    The family variable will work fine, it is copied to all the objects in the family. So when you select a specific family object and set its variable to something the object will also get this value.

    In the Select & Info.

    You don't have to store the UID of the RadarObject in a local variable same goes with the description. As you have already selected one with the "On tap" so if you did a "Set description = "This is a description" only the selected object would get this description.

  • I assume you want to make some kind of infinite game?

    In most cases the best you can do is to fake it, so it gives the illusion of looping. Which you can do if you make some background objects and spawn them at the edge and let them travel to the opposite edge. And then make it so they spawn at different X coordinates and maybe let them travel at different speed.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I see ill delete it then. Thanks for clearing that up

  • Wasn't a bug after all

nimos100's avatar

nimos100

Member since 23 Sep, 2012

None one is following nimos100 yet!

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies