linkman2004's Recent Forum Activity

  • Yeah, x is simply a stand in for a variable of your choosing. For example, you could use:

    (sin((time * 1000) + 270) + 1) * 49.5 + 1

    Where "time" is the actual system expression for elapsed time in seconds - multiplying this value by 1000 gets you milliseconds. Multiplying "time" by a higher number will increase the speed of oscillation while multiplying by a lower number will decrease the speed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alternatively, if you want the silky smoothness of sine, you could just set your variable to:

    (sin(x + 270) + 1) * 49.5 + 1

    This will oscillate between 1 and 100. x can be any value you want, such as a variable you iterate by yourself, or you can take the game time and have a nifty one line solution.

    EDIT: Here's a Google Graph for the Hell of it

  • This is intended - you may have cases where you want to interact with an invisible object. Just check if your object is visible in the click event if you want to avoid interacting with it when it's not.

  • No problem, man - let me know if you run into anymore problems.

  • I had some suspicions that your problems were caused by incorrectly placed hot spots and that is indeed the case.

    Your 'PainBox' object has a hot spot that is far right of center, resting in a position such that - given that the X and Y coordinates represent this point - your player's position will always be left of X relative to that object. Centering the hot spot on the 'PainBox' will fix your knock back problems.

    For the health bar, your hot spot is once again out of alignment based on the effect you want. Placing the health bar's hot spot on the left edge of the image will result in the image extending towards the right relative to the hot spot, just as you want.

    As a nifty little trick - which you may already know - while editing hot spots in the image editor, you can use the number pad on your keyboard to quickly position it to the edges/center/corners of your image. So, for example, 4 sets it to the left edge, vertically centered; 5 to the center; etc.

    I hope all of this helps you out. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Well, I can tell you how to fix number 3. For each frame the player's health is equal to zero it will keep resetting the "Death" animation over and over again which means it never finishes - adding a "Trigger once while true" condition after the health check condition in event 6 should fix that by making the event run once.

    I can't be sure what's wrong in the first two cases - I have no context for what the objects are or how they're set up. If you provide your CAP file I'll be glad to look at it and help you out.

    I'll just mention that setting the X position of HealthBar won't do anything as HealthBar.X and your 'Location' variable are equal without changing.

  • I waited two solid minutes for it load on my Playbook but it never left the white screen - I'm running OS2.1.

  • This all comes down to an issue of reflexes - it's difficult to hold down a key for a single frame, thus the key may remain held for an additional one or two frames unintentionally causing unwanted movement.

    My solution

    I introduced a three frame timer into the equation to solve the problem. By moving once upon a key first being pressed, then utilizing a timer to delay movement a few frames before resuming movement, you can now move one pixel at a time and yet still move with a largely imperceptible input delay.

    I hope this helps. :)

  • If you post a CAP file, I can check it out and see what's going on.

  • Whoops, sorry I missed this - let's see what I can do for ya.

    Unfortunately I'm not sure I can answer your question about the link error - however, If I remember correctly, the 8 direction movement is working off a much older version of the SDK, and I believe some dependencies changed along the way, so that's probably the likely culprit.

    As for question two, I actually needed something similar for my gravitation behavior. What I'd suggest is adding a static CRunObject* to your class declaration in Main.h after the ACE function declarations. In Runtime.cpp you'll have to define it - I have it after the #ifdef RUN_ONLY line.

    Main.h:

    ////////////////////////////////////////////////////
    // Data members
    
    // Use when private variables (OF_PRIVATEVARIABLES) are enabled.
    //vector<ExpStore> privateVars;
    
    // Initialize the vector of object pointers for accessing data across objects
    static CRunObject* playerObject;

    Runtime.cpp:

    //////////////////////////////////////////////////////////////////////////////////
    // Runtime functions
    //////////////////////////////////////////////////////////////////////////////////
    #ifdef RUN_ONLY
    
    CRunObject* ExtObject::playerObject;

    After that, you can create an action where you provide an object as a parameter and slip it your player instance. All instances of your enemy behavior will have access to the pointer since it's static.

    On another note, In Construct have you heard of including event sheets? If you right click in the event sheet editor, there's an option to include another event sheet - just place all of the code you want to reuse in one sheet and include it wherever you need it. It's one of my favorite Construct features.

    I hope all this helps. Good luck!

  • The difference is mostly in how they're setup - in "Main.h" there's a line near the top that starts with:

    #define IDE_FLAGS

    Adding the OF_MOVEMENTPLUGIN flag tells the editor that you're plugin is a behavior, as such:

    #define IDE_FLAGS OF_MOVEMENTPLUGIN

    Additional flags can be added by using the bitwise OR operator:

    #define IDE_FLAGS OF_MOVEMENTPLUGIN | OF_NODRAW

    The area near the type has a list of other supported flags, but most aren't relevant for behaviors.

    The pLink pointer points to the object attached to your behavior, and you can access/modify it's attributes by, for example, using:

    pLink->info.x

    This will access the X coordinate of the attached object.

    With a normal plugin, you access its properties in a similar fashion, but instead of pLink you'd use this to refer to the plugin:

    this->info.x

    Those are the basic differences to be aware of - It's been a while since I've done any real SDK work, but the info I've give you should be about right.

    As for the ATL and MFC requirement, that is indeed the case - I believe someone may have made a version of the SDK that excluded those libraries, but I'm not 100% certain on that. If you're a student, you can always sign up for Microsoft Dreamspark to get Visual Studio 2008/2010 Pro for free.

    EDIT: This thread should help you out getting VS Express working with the SDK.

  • The source for quite a few of the built in behaviors can be found on the Construct Classic SVN. Source for many of the plugins is also up there. In addition, here's a basic plugin tutorial from the old wiki.

    It's recommended that you have a basic working knowledge of C++ to work with the SDK - not that I let that stop me. <img src="smileys/smiley17.gif" border="0" align="middle">

    If you have any specific questions on how things work, go ahead and ask - there should still be a few people around here who can help you out, myself included.

linkman2004's avatar

linkman2004

Member since 15 Jan, 2008

Twitter
linkman2004 has 1 followers

Trophy Case

  • 16-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

18/44
How to earn trophies