Changeset 297


Ignore:
Timestamp:
Jan 26, 2011, 6:35:55 PM (10 years ago)
Author:
sam
Message:

Use monster eyes as particles for the exploding effect.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/deushax/debugsprite.cpp

    r295 r297  
    4646    Entity::TickGame(deltams);
    4747
    48     float3 move = deltams * 0.1f * (float3)Input::GetAxis(0);
    49     data->pos = data->pos + move * float3(sqrtf(2.0f), 1.0f, 1.0f);
     48    float3 move = deltams * (float3)Input::GetAxis(0);
     49    data->pos = data->pos + move * float3(0.1f * sqrtf(2.0f), .1f, 0.1f);
    5050}
    5151
  • trunk/monsterz/board.cpp

    r295 r297  
    7070    data->whip = Sampler::Register(WAV_WHIP);
    7171
    72     data->emitter = new Emitter(data->tiles, float3(0, -0.0003f, 0));
     72    data->emitter = new Emitter(data->tiles, float3(0, -0.0006f, 0));
    7373    Ticker::Ref(data->emitter);
    7474
     
    8080        {
    8181            int id = 100 + 20 * (rand() % 7);
    82             data->pieces[i][j] = new Piece(game, int2(i, j), id);
     82            data->pieces[i][j] = new Piece(data->emitter, int2(i, j), id);
    8383            if (j)
    8484                data->pieces[i][j]->SetBelow(data->pieces[i][j - 1]);
     
    107107{
    108108    Entity::TickGame(deltams);
    109 
    110     /* Temporary test: add a few particles */
    111     for(int n = 0; n < 10; n++)
    112     {
    113         int id = 110 + 20 * (rand() % 7);
    114         float3 pos(RandF(500.0f), RandF(500.0f), 8.0f);
    115         float3 vel(RandF(-0.1f, 0.1f), RandF(0.05f, 0.1f), 0.0f);
    116         data->emitter->AddParticle(id, pos, vel);
    117     }
    118109
    119110    int2 mouse = Input::GetMousePos();
     
    293284    do
    294285    {
    295         Mash *mash = new Mash(data->game);
     286        Mash *mash = new Mash(data->emitter);
    296287        Ticker::Ref(mash);
    297288
     
    319310            int2 newpos = int2(i * 48, below->GetPos().y + 48);
    320311            int id = 100 + 20 * (rand() % 7);
    321             data->pieces[i][7] = new Piece(data->game, int2(i, 7), id);
     312            data->pieces[i][7] = new Piece(data->emitter, int2(i, 7), id);
    322313            data->pieces[i][7]->SetBelow(below);
    323314            data->pieces[i][7]->SetPos(newpos);
  • trunk/monsterz/mash.cpp

    r294 r297  
    3030
    3131private:
    32     Game *game;
     32    Emitter *emitter;
    3333    int duh, pop;
    3434    Piece *pieces[8 * 8];
     
    5151 */
    5252
    53 Mash::Mash(Game *game)
     53Mash::Mash(Emitter *emitter)
    5454  : data(new MashData()),
    5555    nextmash(NULL)
    5656{
    57     data->game = game;
    58     Ticker::Ref(game);
     57    data->emitter = emitter;
     58    Ticker::Ref(emitter);
    5959    data->duh = Sampler::Register(WAV_DUH);
    6060    data->pop = Sampler::Register(WAV_POP);
     
    156156    Sampler::Deregister(data->duh);
    157157    Sampler::Deregister(data->pop);
    158     Ticker::Unref(data->game);
     158    Ticker::Unref(data->emitter);
    159159    delete data;
    160160}
  • trunk/monsterz/mash.h

    r266 r297  
    1313
    1414#include "entity.h"
    15 #include "game.h"
    1615#include "piece.h"
    1716
     
    2120{
    2221public:
    23     Mash(Game *game);
     22    Mash(Emitter *emitter);
    2423    virtual ~Mash();
    2524
  • trunk/monsterz/piece.cpp

    r294 r297  
    2929
    3030private:
    31     Game *game;
     31    Emitter *emitter;
    3232    Piece *above, *below;
    3333    int tiler;
     
    5353 */
    5454
    55 Piece::Piece(Game *game, int2 cell, int id)
     55Piece::Piece(Emitter *emitter, int2 cell, int id)
    5656  : data(new PieceData())
    5757{
    58     data->game = game;
    59     Ticker::Ref(game);
     58    data->emitter = emitter;
     59    Ticker::Ref(emitter);
    6060    data->above = NULL;
    6161    data->below = NULL;
     
    276276        data->timer -= deltams;
    277277        if (data->timer < 0.0f)
     278        {
     279            float3 pos(data->pos.x + 24, data->pos.y + 177, 5);
     280            int start = data->id + 10;
     281            int stop = data->id + 13;
     282            for (int id = start; id < stop; id++)
     283            {
     284                float3 vel(RandF(-0.3f, 0.3f), RandF(0.2f, 0.3f), 0.0f);
     285                data->emitter->AddParticle(id, pos, vel);
     286            }
     287
    278288            data->state = PieceData::DEAD;
     289        }
    279290        break;
    280291    case PieceData::DEAD:
     
    338349    if (data->below)
    339350        Ticker::Unref(data->below);
    340     Ticker::Unref(data->game);
     351    Ticker::Unref(data->emitter);
    341352    Tiler::Deregister(data->tiler);
    342353    delete data;
  • trunk/monsterz/piece.h

    r294 r297  
    1212#define __DH_PIECE_H__
    1313
    14 #include "entity.h"
    15 #include "game.h"
     14#include "core.h"
    1615
    1716class PieceData;
     
    2019{
    2120public:
    22     Piece(Game *game, int2 cell, int id);
     21    Piece(Emitter *emitter, int2 cell, int id);
    2322    virtual ~Piece();
    2423
Note: See TracChangeset for help on using the changeset viewer.