nimos100's Forum Posts

  • [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

  • Hello,

    I have objects have pathfinding, but sometimes they don't move, and after i close game and open it again, they start moving. (android)

    on path found -> move along path

    i also have this.

    I don't think we need capx, because IT IS SOMETIMES WORKING, AND SOMETIMES NOT WORKING. that means they can move sometimes, so there would be nothing in the events. i wonder if it is a bug or sth of pathfinding/c2/crosswalk. (also sometimes happens when testing in the browser)

    Anyone experienced this problem?

    Not saying it is, but your problem might be related to this one that I experienced. If there is something wrong with the path finding behaviour. Then it might explain why yours sometimes work and sometimes doesn't.

    https://www.scirra.com/forum/path-finding-why-doesnt-this-work_t117025

  • Problem Description

    Path finding is not working correctly, seems to ignore all other objects collision settings besides the first added object to the project that uses the behaviour.

    Attach a Capx

    Description of Capx

    Move two objects from there starting position to a X,Y coordinate. And on the way they have to move around some obstacles.

    Steps to Reproduce Bug

    Full description of the problem can be found here - https://www.scirra.com/forum/viewtopic.php?f=147&t=117025&p=842288#p842288

    Its not easy to explain without adding a lot of screenshots. Which are already added in the forum topic.

    Observed Result

    Ignore all other path finding objects collision settings, and uses the settings for the first added object to the project that uses path finding.

    Expected Result

    That each object would use its own collision settings.

    Affected Browsers

    Not browers specific.

    Operating System and Service Pack

    Windows 7

    Construct 2 Version ID

    r182

  • Yeah making one now

  • Seems to have something to do with that it only take the first object into account. The red object was the first one added and if I delete that from the project the path finding works again. However now its just does the same with the green object as its now the first object, so if I add another object again. Then the green object is controlling the path finding and that one bugs again.

  • Pretty sure its a bug, did some more testing.

    Added another object to test against collision with.

    If I tell that the green object should collide with it, it doesn't react at all. However if I disable that and enable that Red object should collide with it, both of them again try to avoid it.

    However now it gets even weirder

    If I change the code like so.

    They behave like this, and just completely ignore the tilemap

  • I think it is a bug. Seems like there is only one global pathfinding obstacle map and not instance specific. Even if another is set to solid and other for custom it doesn't seem to work.

    Perhaps an oversight after regenerate region feature?

    Yeah you might be right, I cant recall if I have had this problem before.

    But I cant figure out if its just something I have forgotten to check, but have use the path finding behaviour so much, that I would be surprised if that was the case, also why I ended up checking the manual to see if I had forgotten something. But cant see that there should be anything wrong with what im trying to do.

    I also tried to move Clear obstacles for the green object to the On key pressed event and regenerate it there according to the manual, but doesn't make any different.