Ruskul's Recent Forum Activity

  • Hey everyone,

    I have a story and something you should avoid.

    When writing events in construct, you can refer to an object that has no instances. This is fine if you want to read some default instance variable or behavior value off it - such as max speed or gravity power. But what you can't do is change something that doesn't exist. For example:

    On start of layout -> set playerObject physics stepping mode to framerate independent...

    more events, more events, more events... blah blah blah...

    Create playerObject at playerSpawnpoint.

    The result of this is that you do not have framerate independent physics because you couldn't change the physics behavior from an object that doesn't exist. In a large project with thousands of events, errors such as these can be easy to create, nearly impossible to find and worse may remain hidden for weeks.

    Don't spend hours of debug time trying to figure out why something doesn't work only to find a mistake like this. The worst part is construct is happy to go along with bad events like this... same thing for calling functions that don't exist. Its like if you told an employee to bring the client in the waiting room some coffee. The employee goes to the coffee room and finds no coffee. Instead of telling you, he just abandons all other subsequent instructions and asks for the next set of directives... Well, he thinks to himself, you are the boss and you must know there is no coffee. What a bizarre instruction. Oh well, best to carry on.

  • zenox98 - thats what I was looking for.... I looked around for that but couldn't find it >.< (I have owned construct 2 for a year now and never new the preference button existed >.>

    Thanks.

  • RESOLVED

    Problem Description

    I recently used a second monitor while working with construct. In order to transcribe an objects instance variables into another language/engine I opened the instance variable dialog and placed it on the other monitor. I now no longer have access to a second monitor but construct remembers the position of the instance variable dialog window as being on the other screen. I can't edit them now!

    I have disabled the second monitor in properties and control panel and as far as the computer goes, there is no second monitor but construct 2 keeps opening dialogues off screen if that was the last place they were!

    Construct 2 has no "set windows and dialogues to default positions" option (which many programs, such as photoshop, have in order to fix this issue) Is there a way around this? If not I would say construct 2 needs a way to move dialogue windows back on screen! I can't work on my project right now.

    ------------------------

    edit

    It is possible via windows shortcuts to select the dialogue window and move it on screen.

    Alt+space -> m -> hit an arrow key -> move the mouse around till you can see it.

    Attach a Capx

    n/a

    Description of Capx

    n/a

    Steps to Reproduce Bug

    • Step 1 - Plug in a second monitor and move a dialouge to the second screen space. Save project and close.
    • Step 2 - unplug and disable the second monitor. Re open construct 2.
    • Step 3 - Open up previously used dialogue windows (such as instance variables) that had been moved to second monitor... (they open off screen and can't be touched/edited)

    Operating System and Service Pack

    Windows 7, latest service pack

    Construct 2 Version ID

    Release 173 (64 bit)

  • Howdy,

    I have plenty of solutions laying around as there are many but my favorite way is the following:

    Terminology:

    ObjectCollider = the object that collides with solids and is the object that is moved around

    ObjectState = The object that determines what direction collisions are occurring from. The size of the sprite should be one pixel greater on all sides as the objectCollider, with the same origin as well. The collision polygon should then be adjusted so that it is only on the right of the Sprite. Depending on the scenario, you will need to adjust the relative sizes of the boxes based on your needs. Also, the Object state needs the following instance variables: Up, Down, Left, and Right (they are booleans). This way will work if the object is square or round. (if other then see note below)

    Whenever you create an ObjectCollider it creates an Object State (you can put these in containers so it happens automatically, but if you need them in families it gets a little more difficult as you would need to track UIDs and use parents)

    Every Frame, ObjectState needs to be updated in the following ways:

    1. Set its position to the parent ObjectCollider

    2. If it is overlapping an object that is Solid set "Right" to true, else set it to false.

    3. rotate ObjectState 90 degrees (now it is facing down) and test for overlapping solids...

    4... I think you can figure out the rest...

    If you are not using a round or square object, then you will need to create an ObjectStateUp, ObjectStateDown, and so on and attach them to respective image points on the ObjectCollider.

    Any Questions? Overall, this is a pretty basic need in games and I am supprised their has not been made a behavior to get that data. I need this in every game I make so I created a blank project that uses families and does it all automatically when I create an object and put it in family SpriteColliders.

  • Hey everyone!

    I think the title says it all... Construct2 needs to be able to copy objects. Further It should also be able to copy shared instance variable through families. For ex:

    Bat (of family FlyingAnimals) = Eagle (of the same family)

    Behavior copying should aslo be allowed... ie:

    SomeObject.physics settings = someObject.physics settings.

    Construct 2 also needs to be able to pick any object and then test its type. With only 1 family (and since families are abstract you always need to refer to objects) things get difficult with complex objects.

    anyway...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Everyone!

    I think construct 2 needs to allow one to be able to group instance variables.

    For example

    Group Constants could contain acceleration, deceleration, jump power. You would access these in the event sheets by... SomeObject.Constants.acceleration.

    This isn't needed for small scale projects but as soon as you need more complex behaviors you need tons and tons of instance variables. I used to just make multiple objects to store different info (like playerState and playerMath) - but given constructs limitations in polymorphism you can't simply scale a project built like that...

    anyway... it would help with organization. My hunch is that those of you who disagree either haven't attempted anything grand in scale or found a better way to organize data in construct 2 (in which case I am all ears!)

    Thanks!

  • There is indeed!

    If you are simply replacing the graphics, you can double click the sprite and load the graphics in.

    If you created a new sprite that has a different name and you want to replace the other sprite with the new one and the old one has events associated with it then do the following:

    1. Back up your project.

    2. Go to your event sheet(s) and search for events using the name of the sprite you want to replace.

    3. Highlight all events that are returned and right click them

    4. Select replace object. Choose the object you want to replace and then choose the object that is replacing it.

    You need to make sure the new sprite is exactly the same as the old one. This means it has to have all of the same variable names, behaviors, applied effects, and so on. Construct will only allow you to replace objects if they are identical (besides graphics and collision polygon... but you would need the same number and names of image points too (I think)).

    Anyway, best of luck! I hope that helps.

  • codah - they would be objects that inherit the behavior of the compound object

  • Aphrodite: So it is okay to use them so long as they get renamed? That's okay then. I thought Ashely meant not to build off of them period. I understand why but I didn't know if what I had done was not the right answer for the problem.

    I know others would disagree, but I would be happy to see cocoonJS go if it meant potentially getting more out of box2d in construct. But, as I am a pc only developer, I feel like my say is one sided.

    Thanks

  • Okay folks... this might be an impossible question...

    I want to create a compound family object.

    Each character in my game has the following objects:

    1. CharacterSprite (the animation object)

    2. CharacterCollider (with physics behavior attached)

    3. CharacterState (checks for collisions up, down, left, and right. Also checks what direction the character is going relative to the direction of gravity. Using all of this the object sets flags for such things as "inAir" "Onground" and "OnLeftWall"

    4. CharacterCollect (an object used to test for collisions with collectables and powerups)

    5. CharacterHitBox (an object to test for collisions with objects that can damage it)

    I also have a few extra objects to manage the butload of variables and constants needed for functionality.

    All of these objects have to communicate with each other, but regardless of what the character is (fish, turtle, or bird), the character state will always do the same thing, but I need to know what its state is before I can tell it to fly. Setting this stuff up for every character in a game with dozens is tedious, repetitive and time consuming.

    I can also say that I could write this up in C# using OOP with no trouble but I can't figure out how to do it in construct without being able to derive objects from one another. any ideas?

    I thought about just creating a family for each type of object in the compound object and another family to rule over them, but then I am still left with creating a bunch of objects manually.

    Thanks,

  • So... I'm guilty here... but in my defense there wasn't much of an alternative - at least not that I can see.

    ...Construct 2 has good built-in physics.

    ...Yes, but at the same time... no.

    physics support in construct 2 is limited when compared with box 2d. I need kinematic bodies and prismatic joints (basic and very much needed box2d functionality). I have been basically told that these features will probably not officially make it to construct 2. I edited the official behavior to expose this functionality. It took like 2 hours, and that was knowing nothing about behaviors and javascript. It works just fine and still does.

    How else can I make this happen if not by altering the official physics behavior?

  • Create 2 objects: the actual bar and the area the bar sits in. These should be created in a layer with parallax set to 0 (so these objects won't scroll). The bar needs some instance variables as well (IsClicked)

    Then add the following events:

    If bar clicked ----- set bar.IsClicked to true

    if mouse click released && if bar.IsClicked = true ------ bar.IsClicked = false

    If bar.IsClicked = true ------ set bar position (self.x, mouse.y)

    EveryTick --------- Scroll to position (scroll.x ,( bar.positionY * some scale factor))

    Because you have the scroll bar in its own layer that does not scroll, it should remain in place regardless of scroll. Some scale factor, if set to 1, will scroll as far as you move the bar. I would set this to 2 or 3 depending on how far you need to scroll.

Ruskul's avatar

Ruskul

Member since 23 Nov, 2013

Twitter
Ruskul has 2 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x6
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

17/44
How to earn trophies