Zephlon's Recent Forum Activity

  • I modified the Physics plugin to add an action that destroys all Physics Joints. All is well until I get this error in the console, then it can't register any more joints as well as other weird behaviors.

    <font face="Courier New, Courier, mono">Uncaught TypeError: Cannot read property 'm_collideConnected' of undefined

            Physics_behavior.js:6523

        Box2D.Dynamics.b2World.DestroyJoint

            Physics_behavior.js:6523

        behinstProto.destroyMyJoints

            Physics_behavior.js:12158

        acts.destroyMyJoints

            Physics_behavior.js:12685

        actionProto.run_object

            eveng.js:1020

        eventblockProto.run_actions_and_subevents

            eveng.js:502

        eventblockProto.run_orblocktrigger

            eveng.js:490

        runtimeProto.triggerOnSheetForTypeName

            eveng.js:1963

        runtimeProto.triggerOnSheet

            eveng.js:1857

        runtimeProto.trigger

            eveng.js:1821

        instanceProto.onKeyDown

            Keyboard_plugin.js:88

        (anonymous function)

            Keyboard_plugin.js:54

        f.event.dispatch

            jquery-1.7.1.min.js:3

        f.event.add.h.handle.i

            jquery-1.7.1.min.js:3</font>

    I added this code to edittime.js

    <font face="Courier New, Courier, mono">AddAction(901, af_none, "Break joints", "Joints", "Break all {my} joints", "Break all physics joints on this object.", "destroyMyJoints");</font>

    And this code to runtime.js

    <font face="Courier New, Courier, mono">acts.destroyMyJoints = function () {

         this.destroyMyJoints();

    };</font>

    Here is the capx for the game the error occurred in.

    http://dl.dropbox.com/u/52788071/frisbee.capx

    The frisbee will "stick" to a pole when it hits it and spins around it until you either right-click or press space bar. You can control the frisbee while it's on a pole in any of three ways:

    • Click on the frisbee to push it.
    • Use the arrow keys to move it.
    • Hold down the left mouse button anywhere but the frisbee. A white ball will appear. Move the mouse to hit the frisbee with the ball. When you let go the ball will disappear.
  • Because tab switches between different controls (i.e. buttons, text boxes, check boxes, etc.). It's like the standard for all windows programs.

  • That would work, but it won't save the player's progress. So if the player closed the game and reopened it, he would be back at level 1.

    Also, it is not a good idea to have multiple copies of the same event sheet. Even if some of the variables have different values.

    • What if you wanted to change how the game works? You'd have to change the same little thing for all of the levels.
    • It increases the file size more than nessesary. In a case where you have a lot of events for each level, the player will become impatient when your game takes forever to load and go find a different game to play.
    • If you wanted to add a few levels, you'd have to duplicate one of the event sheets and change it accordingly.

    It is better not to repeat the same instructions over and over, but instead to say it once and put variable where it's different.

    Instead, you should do something like this:

    Make one sprite object, name it levelbox. Right-click on it, choose add/edit instance variables, click the green plus sign, name the variable level and give it a type of text, click ok, and close the add/edit instance variables window. Hold ctrl and move the levelbox. This copies it. Do this until you have enough for each level. Edit each one to have the name of one of the levels (layouts) in the level instance variable (you can find it in the properties). If you don't want to type the name out each time, you can copy something like "Level " to the clipboard and paste that into the textbox then type the number. Example: Click levelbox, click the box next to "Instance Variables, level", press Ctrl+V, type "1", click the next levelbox, click the box next to "Instance Variables, level", press Ctrl+V, type "2", etc.

    -- Menu Events --

    system.every tick -> set opacity to 40 for all level boxes in the menu.

    Declare Local Variable unlock_level = 1

    System - For Each levelbox

    If unlock_level = 1 -> then set levelbox opacity to 100%

    (Event with no conditions) -> System > set variable unlock_level to WebStore.getLocalKey(levelbox.level)

    On levelbox clicked, and -

    levelbox opacity is 100% -> system go to levelbox.level

    -- Game Events --

    When a level is finished -> WebStorage > Set Local Key > LayoutName to 1.

  • You can have the variables that are different attached to an object (like the player). Just click on the object, go to properties, and click "Add/Edit Instance Variables". Then if there isn't anything else different, delete all of the event sheets but one (except for the menu events) and make sure all of the levels point to the same event sheet.

  • First, you can have more than one layout share the same event sheet. Second, each of the level boxes should be multiple instances of the same object. (Create the first one, name it, and then move it while holding ctrl to copy. Or, right-click>copy, then right-click>paste.) To have multiple frames for one object, open the first one, create a new frame (right-click in the frames window, click add frame), make sure the new frame is selected, and open the next image.

    Try this:

    dl.dropbox.com/u/52788071/Menus.capx

    Does your game keep track of score? If not, we'll need to do this differently; because this is like a level select menu and high-score system in one.

  • The basic idea is that, at the end of a level, you store the highscore in a database of some kind (I used the WebStorage object). Then you create a sprite on the level select menu with one animation for unlocked, and one for locked. Then at the start of the layout you iterate through all of the levels and if the previous level has a highscore greater than zero, unlock it.

    I can explain in more detail, but I'll need to know if you want the menu to be automatically generated and if you want multiple pages.

  • One more thing, how about this one?

    Event: System->Compare x = 1 / Action: System->Set value X = 0

    Event: System->Else / Action: System->Set value x = 1

    After this runs, what is the value of x? <img src="smileys/smiley4.gif" border="0" align="middle" />

    If x = 1, then x will still = 1 and X will = 0. (Unless Construct 2 is case-insensitive.)

    If x = 0, then x will = 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just create a new condition or event System->Pick Random Instance.

    http://www.scirra.com/manual/124/system-conditions

  • Have you tried using the sine behavior?

    http://dl.dropbox.com/u/52788071/bees.capx

  • Try this.

  • What i don't know is how many impulses are being executed.

    Create a number variable, add one to it after applying impulse, and log it to the Chrome Console. That should tell you how many times it applies impulse.

  • First, you should give all of the Sprite## objects names. I made some changes to your capx.

    Try this.

Zephlon's avatar

Zephlon

Member since 28 Nov, 2011

None one is following Zephlon yet!

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies