Beware with the guy at the right
Wednesday, February 26, 2014
Friday, February 21, 2014
Time for triggers
The main change in this version is that I've added a triggering system, in the map editor one can add as many triggers as he wants.
There is a file for each level called triggers.map
[1]
x=92
y=59
ClearTile=-78,-54
ClearAttribute=0,0
PlaySound=wall.wav
The values mean:
Then there is class called TTriggerDispatcher which contains all possible methods to be called, for instance:
The way that this is handled is via rtti:
From the map editor one can design some game logic. All files should be at skydrive
BB)
There is a file for each level called triggers.map
[1]
x=92
y=59
ClearTile=-78,-54
ClearAttribute=0,0
PlaySound=wall.wav
The values mean:
- TriggerId
- Trigger x position
- Trigger y position
- Function to call and parameters
Then there is class called TTriggerDispatcher which contains all possible methods to be called, for instance:
procedure TTriggerDispatcher.PlaySound(aX, aY: integer; const aName: string); begin TSoundDispatcher.Instance.Play('Sound\' + aName); end; procedure TTriggerDispatcher.SpawnEntity(aX, aY, aOfsX, aOfsY, aEntity: integer); var info: TMapInfo; entity: ISprite; begin info := TMapInfo.Create((aX + aOfsX) * FLayer.XTileSize, (aY + aOfsY) * FLayer.YTileSize, NO_TILE, aEntity); entity := TSpriteFactory.Instance.New(info); (entity as IWarp).Warp; end;
The way that this is handled is via rtti:
procedure TGameTrigger.Invoke; var info : TRttiType; method: TRttiMethod; params: TArray<TValue>; context: TRttiContext; par, i: integer; begin if FTarget = '' then raise Exception.Create('Invalid target'); context := TRttiContext.Create; info := context.GetType(TTriggerDispatcher); method := info.GetMethod(FTarget); if method = '' then raise Exception.Create(FTarget + ' does not exists'); Setlength(params, FParams.Count + 2); params[0] := TValue.From<integer>(FX); params[1] := TValue.From<integer>(FY); for i := 0 to FParams.Count - 1 do begin if TryStrToInt(FParams[i], par) then params[i + 2] := TValue.From<integer>(par) else params[i + 2] := TValue.From<string>(FParams[i]) end; method.Invoke(TTriggerDispatcher.Instance, params); end;
From the map editor one can design some game logic. All files should be at skydrive
BB)
- If no animation assigned in TAnimationSprite then the old exception is no longer happening
- TCollisionMatrix no longer returns the same sprite repeated
- New trigger system
- Triggers can dispatch more than one method
- Map load/saves triggers
- New balls enemy
- New trigger entity
- New music for level no name
- CrushWalls fixed
- When hero is finishing a level, immunity is activated
- Possible triggers at the moment are: clear and set tiles and attributes, play sound and music and spawn entities
- When in water and bubbles are shown and new sound is played
- Triggers used in some levels
Saturday, February 15, 2014
Monday, February 10, 2014
Just another update
Well, just to keep this blog a bit "active" I'm uploading a new version
BTW, SugarSync is already telling me that our deal finishes in 7 days, time to find another place to save the files, but meanwhile here we go SugarSync.
BB)
Engine.Find() and Engine.SpritesAt() returns nil if no sprites (some performance gain)
Minor clipping issue solved (only visible with teleporting)
TDummySprite new property Group
New Engine.Find() per group
New Layer.GetItems() per group
New ICamera.GetPoint()
New ISprite.GetPoint()
HBF)
Music was not resumed after a fight
The under 15 minutes achievement has to be done from the first Level
Hero dies differently...
Shield was not shown when in pause
Some non used graphics removed
Bomb enemy is back with some new explosion (nuclear?)
Bomb now dies with hero shield
All code adapted to Find() and SpriteAt()
Dragon included in level Colors (I think it gets very difficult...)
Spring handling improved
Jumping code harmonized
New falling blocks (crush wall)
New static Play3D() sound that does not need ISprite but TPoint
Time pickup now rather than stop the enemies it just slow them down quite a bit.
BTW, SugarSync is already telling me that our deal finishes in 7 days, time to find another place to save the files, but meanwhile here we go SugarSync.
BB)
Engine.Find() and Engine.SpritesAt() returns nil if no sprites (some performance gain)
Minor clipping issue solved (only visible with teleporting)
TDummySprite new property Group
New Engine.Find() per group
New Layer.GetItems() per group
New ICamera.GetPoint()
New ISprite.GetPoint()
HBF)
Music was not resumed after a fight
The under 15 minutes achievement has to be done from the first Level
Hero dies differently...
Shield was not shown when in pause
Some non used graphics removed
Bomb enemy is back with some new explosion (nuclear?)
Bomb now dies with hero shield
All code adapted to Find() and SpriteAt()
Dragon included in level Colors (I think it gets very difficult...)
Spring handling improved
Jumping code harmonized
New falling blocks (crush wall)
New static Play3D() sound that does not need ISprite but TPoint
Time pickup now rather than stop the enemies it just slow them down quite a bit.
Dragon flying around...
Subscribe to:
Posts (Atom)