Game Logic

(return to Interactive 3D)

    Answers in this category:

    1. How do you set up game logic?
    2. How can you detect a collision in a game?
    3. How do i use ipo's with games ?
    4. How do I add weapons to my games ?( guns, lasers)
    5. How do I use the add object actuator?

    1 - How do you set up game logic?

    Contributed by Daniel Jircik.

    The complete and definitive documentation is here.

    https://www.blender.nl/gameBlenderDoc/book1.html

    (top)

    2 - How can you detect a collision in a game?

    Contributed by Carsten Wartmann.

    Assuming you understand the basics of game logic, and linking, the documentation for that function can be found at:
    https://www.blender.nl/gameBlenderDoc/logicbricks.html#SENSORS

    (top)

    3 - How do i use ipo's with games ?

    Contributed by B@rt.

    To play back an IPO in the game engine Blender uses IPO actuators. Simply enter the start- and endframe and select the IPO playback type.

    The playmodes are described in the documentation at www.blender.nl:

    https://www.blender.nl/gameBlenderDoc/actuators.html#IPOACT

    (top)

    4 - How do I add weapons to my games ?( guns, lasers)

    Contributed by lec.

    Ok here is a step by step tutorial, I hope it helps

    Start up blender

    1) Get rid of the default plane, it should be pink.


    2) add a cube, ->mesh->cube
    then exit edit mode

    3) Create a bullet ( we will use a simple icosphere ).
    ->mesh->icosphere

    4) size the sphere to be about 1/10th the cube
    move mouse towards center of sphere the
    right click when it is the correct size. Hit to
    exit edit mode. Note the name of the bullet object,
    you can see it by hitting and looking at the name
    to the right of the "OB:" field it should be Sphere,
    you can change it, but if you do remember the name
    that you will give it because you will use it later.

    5) move the bullet to another layer ( we will move to
    layer 4 in this exercise
    <4-key> and hit ok It should disappear from
    your current view.
    You can see it in layer 4, if you just hit the
    <4-key> it will take to the layer where the sphere is,
    to go back to where the cube is hit <1-key>

    6) Now we will set up the game buttons to have the
    cube shoot the bullet.
    hit here you will see 4 columns, one says "add
    property" and three say
    cube in a long gray box. Above each box and to the
    left you will see a
    tag that says "sensors" for the left box,
    "Controllers" for the center box,
    and "Actuators" for the box on the right.

    7) Add a new sensor, go to the right pink box next to
    the left column that says cube.

    8) add a controller, the pink box on the center column

    9) add an actuator, the pink box on the right column.

    10) link them, click on the little golden ball and
    drag a line to the small gold circle to it's left.
    Repeat for the other column as well.

    11) Click on the little field in the sensor that has
    "f:0" in it and change the value to 10, or 20 or any
    number not too large.

    12) Go to the actuator column ( the one to the right )
    and right underneath the long box that says "Cube" you
    will see a box that says "Motion -" click on it and
    you will get a bunch of menu choices. Move down to the
    entry that says "Edit Object"

    13) Add the name of the object in the field next to
    "OB:" This is the name of the bullet object ( it
    should be "Sphere: if you did not change it ).

    14) The three boxes to the right of the "linV" in the
    "Edit Object" box, has three values linear velocity
    for x, for y, and for z, this is where you select the
    direction of your bullet. Try setting the value of y
    to 10 and hit to see it play, Change the other
    two fields (combining for different direction) and
    that is it.

    Good luck, hope this helps

    Luis

    (top)

    5 - How do I use the add object actuator?

    Contributed by Zycho.

    To learn how to use the add object actuator follow this simple example:

    -start Blender
    -don't delete the default plane, but add an empty
    -add a new sensor, controller and actuator to the empty
    -connect them and change the actuator to Edit Object >> Add Object
    -in the OB: field, type Plane
    -increase some of the linV values
    -now select the plane and move it to another layer
    -press p and see the planes getting added!

    (top)


    This Blender FAQ was generated on September 24, 2001, 8:40 am. For the most recent version and for searching the tutorial database, please visit the on-line version at https://helium.homeip.net/support