TheInstance's Recent Forum Activity

  • ..

  • This is the .cap we start off with.

    Lets move the black square with the arrow keys, and keep it between the walls.

    There is a very nice behavior to do this.

    (I freely assume that you walked trough all this )

    From out the layout editor, select the black square (Box), and it give the "8 direction" behavior.

    You can keep the initial values in the behavior's properties for now.

    Run all ..

    and yes it moves, very nice even. But it will go trough the walls.

    To keep the Box from intruding the walls, we must tell the physics system in the "8 direction" behavior that the walls are Solid objects.

    Select any wall object (i did not give them names since we are not gonna use any event, sorry ?) .

    So select any wall object,

    uncollaps the "groups" properties,

    uncollaps the "attributes' properties under "groups"

    toggle the "solid" properties

    Since all wall objects are an instance of the same object. They all will be set "solid"

    Run all ..

    Perfect. This runs very nice. Even when we make the "play field" a little more complicated.

    Make the grid 40 by 40.

    Toggle the grid to make it snap.

    Copy one of the wall objects, and place a copy at

    x = 120

    y = 120

    The Grid is a big help in doing this.

    Place another copy at

    x = 520

    y = 120

    Scale the Square to 40 by 40 in its common properties.

    Run all

    Perfect.

    Even if we make the Box non-square, by scaling it to 20 by 40.

    The behavior will behave perfect.

    This is a very well made behavior.

    Assuming that the box is really free to walk and go where it pleases to go.

    There are many games though, like pac-man, where the moving sprite needs to be aligned on certain horizontal and vertical lines.

    Our box just moves where ever it can move.

    But that is for later.

  • ...

  • There are many open source 3D engines in the form of library's and SDK's.

    Like there are:

    http://www.delta3d.org/

    http://irrlicht.sourceforge.net/

    http://www.ogre3d.org/

    and more.

    Almost nothing needs to be coded from scratch to enrich Construct with 3D and 3D physics.

    This if i understand this well. I am not a programmer.

    I dont think that Ashley dont want to. Reading his last comments i have the feeling that he just has no time. And the 2d engine is not even out of Beta yet.

    Jumping in his shoes, i dont see how he could manage all this, working on perfectioning the 2d shaders, and the events system, and the interfaces to it all, AND bring a 3D engine in something thats not stable yet.

    But i do think that the future lays in bringing together construct and one of the open source 3d engines. Why re-invent water ? Its all done already, and its here as SDK's and C++ librarys.

    So ? who's gonna do it ?

  • Just Run this cap, and explore the buttons, and move the thingy.

    The thingy stops moving when it detects overlapping or collision between the red thingy and the green walls.

    You will see very clear what a detection by Point, bounding, and pixel means,

    and what happens when the objects that overlap/collide have different detection methods.

    The points, the boxes, or curve point to where the collisions happen.

    You will also notice the limitations of the overlapping/collision system

    if you use the same object

    as player object (a sprite moved by the player)

    and to detect where this same object has to stop (at its boundary's, like a maze, walls etc .....)

    One of my next post will be about "sensors".

    In the "sensor" approach we will use one visible object that we move around, and several other objects (invisible sensors) to sense its movement boundary's.

    Plz play with this a few, and try to understand what happens.

    http://www.mediafire.com/?ektnza4wt25

  • So all there is to say about Containers is this ?

    When you create/spawn a "contained" object, the system will automatically create the other *contained* objects to complete the original container.

    How ever the creating is done, in the layout or by events.

    When you destroy one *contained* object, all *contained* objects will be destroyed.

    Shortly said: the system will always complete a container by creating the missing objects, but when the "incompleteness" is created by a destroy event, the whole container is destroyed.

    And not like i read in other posts, every event you apply to a contained object will be applyd to all objects in the container. (wich would be heaven)

  • <img src="http://usera.imagecave.com/j0h/snake/66.jpg">

    <img src="http://usera.imagecave.com/j0h/snake/02.jpg">

    <img src="http://usera.imagecave.com/j0h/snake/03.jpg">

    ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Select the "is global variable" condition under the "every 100"

    press CTRL + c

    select the last "always" condition

    press CTRL +v

    change the "alive" in the condition to "dead"

    Cant be easier.

    Another side effect of using this method is ....

    you force yourself to make a mental snapshot of the context that we used this global variable in ..

    by scrolling back to it, to copy it.

    The story of game, the flow, stays fresh in your mind.

    delete the always in that event.

    Now go to the layout editor. Add a new layer on top.

    Select the layer on top.

    add a sprite "02.png" from the oopz folder

    place it in the middle of the layout.

    toggle its properties "Invisible on start" (under appereance)

    Name it Oopz

    Bring up the Animation organizer on the right.

    Change "default" in "idle"

    Right click an empty spot in the upper part of the organizer.

    choose "add new animation" from context menu

    Name the animation "over"

    The animation, not the angle thingy

    a name is a properties, and those u change on the left .. member ?

    select the angle under "over"

    In the frame portion of the organize you see the number 1

    But there is no sprite/frame yet.

    Right click the "1" ...

    choose "import frames"

    only import the 01.png from the oopz folder.

    Back to the events editor.

    Add a sub event to the last event (is global variable = dead)

    step1: object = mouse and keyboard

    step2: condition = mouse is over object

    step2: object = Oopz

    finish

    add a new action to this.

    step1: self = Oopz

    step2: action = Set animation

    step3: name = "over" (including the "'s)

    finish

    Duplicate that EVENT.

    Right click the CONDITION in that event .. and invert condition

    change the "over" in the duplicated action to "idle"

    Copy the first sub event (the not inverted one)

    double click the condition of the copy to edit it

    one step back

    step2: condition = On object clicked

    step3: parameters: button = left / type = clicked / object = Oopz

    finish

    delete the action is there because of the copy.

    Add a new action to it.

    step1: object = Oopz

    step2: action = set visible

    step3: parameters = Invisible.

    finish

    CTRL+c, CTRL+v (copy) this event.

    In the first one ...

    double click the condition.

    click 2 times back

    step1: object = system object

    step2: condition = Trigger once while true

    finish

    double click the action to change invisible to visible.

    Add another action to the previous event, the "on left clicked event"

    step1: system object

    step2: action = Go to layout

    step3: parameters: layout = "layout 1" (including "'s) / transition = none / duration = 200

    Why duration ?

    Often if the layout has a big "on layout start event", it will crash if you keep the duration on zero.

    A none zero duration, till even 1000 or 2000 when the "on layout start" event includes loops,

    will prevent this crash.

  • Locate the "always" under the comment "dead".

    Right click the event, and add a subevent.

    step1: object = Head

    Step2: condition = Object is outside layout

    finish

    Add an action to that.

    And just copy the action where we set Player_is in the "start layout"

    Change "alive" to "dead" in the action.

    *lazy editing* : )

    Select the sub event "is outside layout" (E-spot) .. CTRL+c, CTRL+v to duplicate it.

    Double click the condition to edit it.

    click one step back.

    step1: object = Head

    step2: condition = is overlapping another object

    step3: parameters: object = body

    finish

    Run all.

    uh oh .. problem.

    The snake does not move no more.

    ALWAYS when you add a collision detection, Run the events.

    To see if the Collision Method needs adjustments.

    Go to the layout editor.

    And change the collision method for each Body to "point"

    double click the "always" condition that starts the dead events to edit it

    step2: condition is compare.

    step3: parameters / value 1 = Vault.Value('X_head') + Vault.Value('Y_head') / comparison = different to / value 2 = 0

    finish

    Copy this condition also under the every 100 milliseconds event.

    This event will have 2 conditions then ..

    The every, the flow alive, and this event that holds the events till player input

    Run again, and now the snake moves again.

  • Dude, Dudette ...

    Thats pretty much that we have done with ONLY 12 events. With Only 6 variables so far.

    Dont you think ?

    If you look at or original planning, there are only 2 more things to do.

    The dead situations, and the "let the player start over again" situations.

    The player will die if the Head will go out of screen, and if the Head bites own body.

    If its Dead, we will pop up a little message.

    And we will not move the head.

    We will not limit the key inputs, just keep the Head from moving.

    In other words, when its dead .. the other events need to know.

    Its time to bring a little flow in the game.

    Make global variable by ..

    Click project in the top menu,

    Click "manage variable" on the ribbon.

    The variable wizard pops up, and its the same as this one for "private variables"

    Make a variable as follow

    name = Player_Is

    type = text

    value = dead and alive

    That value dont really matter.

    Why ?

    well .. When you use a Global variable ..

    and the variable's value is essential for the game starting out the right way ...

    THEN YOU HAVE to initiate the variable in the events.

    And best place to do this is in the "start of layout" event.

    Add a new action under the actions randomly moving Butt in the "start layout" event.

    step1: object = system object (its holding the global variables)

    step2: action = Set value

    step3: global variable = Player_Is / value = "alive" (including the "'s )

    finish

    select the "ever milliseconds" condition (C-spot).

    Right click and "insert new condition"

    step 1: object = system object

    step2: condition = compare global variable

    step3: parameters: global variable = Player_Is / value = "alive"

    finish

    There will be no overlapping to detect, if the Head is not moving.

    So this event does not need this FLOW condition.

    Ok lets Kill the snake.

  • At same time as the butterfly gets eaten, we add another body part.

    It dont really matter at where we create this new instance. Because, the "For Each" pick condition will find it and bring it to the right place.

    Just to avoid a flicker, we will create it out of screen.

    Since this happens under the same conditions that makes the Butt jump to a new location,

    we just add it as action on that place.

    add a new action the "Butt overlaps Head" event.

    step1: choose system object

    step2: action = create object

    step3: parameters: object = body / layer = 2 / X = -20 / y = -20

    finish

    Run all and play some with it.

    change the "eat" comment to "eat and grow"

    delete the "grow body" comment and its "always" pre-made event

  • Back to the Events editor.

    When the snake hits the Butt object. Butt will jump to a new random location.

    Currently, nothing happens if we move the snake over Butt.

    How does the snake know where the Butterfly is ?

    We can of course compare the Head's position to the Butt's position in an compare event. If they are at the same place, we can consider the Butt as eaten.

    Thats very basic. But lets not do it this way.

    There are also the system pick condition "object overlaps point" and "object collides with point"

    Its a pretty fast condition.

    We could use an expression to feed the X and Y of the Butt to the X and Y in the parameters of an "object overlaps point" system condition, and as object the Head.

    This pick condition will pick all instances of an object, and only the instances that overlaps the point given by the X and Y coordinates, will be feed to the sub events and actions.

    But lets not do it this way.

    Locate the comment "eat".

    Add a sub event to the "Always" condition thats already in place there.

    Step 1: base object = butterfly (we will move the butterfly)

    Step2: condition= Is overlapping another object

    step3: parameters: object is Head

    finish

    This is a pick condition. Its takes all instances of the object Butt, and when an instance will overlap with an instance of the object Head, both that instance of Butt and the instance of Head will be set as picked and be feed to the sub events and actions.

    When there is no object picked, i think, no actions and no sub event will run.

    Now just copy the 2 actions that randomly placed the object Butt in the "start of layout" event to here.

    Run this, play a little with it.

    And it will be like the Butterfly jumps away to early.

    Yes from the moment both overlap even with 1 pixels, then the conditions are met.

    Also the butterfly is a little bigger then the 10 based grid, so when ...

    the Head is not going besides it, they will overlap too.

    Go to the layout editor. Select the Butterfly. Locate "collision" in its properties. And change it to point.

    Run all again.

    Now the collision detection is only made when there middle points (the pivot points) overlap each other.

    And yes this is better.

    Under the collision options you will find 4 options.

    None = this object will not detect collision, AND will NOT be DETECTED BY OTHER objects.

    Point = Only the pivot point is used for detection.

    Bounding box = Only the bounding box is used to detect collisions.

    (when you select an object in the layout editor, the bounding come visible as a box of lines)

    Pixel = All pixels in the sprite are used as sensors to detect collision.

    Point will check only one point. which is the fastest detection.

    Bounding will only check the points defined by the math for a rectangle. Its a little slower then "point".

    Pixel will check every point of the sprite, when the sprite is very complicated, thats a slow kind of detection.

    Two objects that detect each other can have different detection methods. And the result is a combination of both.

    When one is on "bounding" and the other on "point". The detection well be made when the pivot point of that one overlaps the bounding box of that other.

TheInstance's avatar

TheInstance

Member since 5 May, 2008

None one is following TheInstance yet!

Trophy Case

  • 16-Year Club

Progress

16/44
How to earn trophies