Skip to content

Commit

Permalink
now postman has initial throwing cards abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Jan 26, 2019
1 parent 599aea8 commit f6f193f
Show file tree
Hide file tree
Showing 27 changed files with 263 additions and 26 deletions.
5 changes: 5 additions & 0 deletions FakeScreen.asc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ function do_once()
}


bool __FakeScreen::isEnabled()
{
return gEnabled;
}


function __FakeScreen::Enable()

Expand Down
1 change: 1 addition & 0 deletions FakeScreen.ash
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ struct __FakeScreen
{
import function Enable();
import function Disable();
import bool isEnabled();
};

import __FakeScreen FakeScreen;
Expand Down
170 changes: 156 additions & 14 deletions Game.agf
Original file line number Diff line number Diff line change
Expand Up @@ -1181,9 +1181,9 @@
<IdleView>0</IdleView>
<ThinkingView>0</ThinkingView>
<BlinkingView>0</BlinkingView>
<StartingRoom>-1</StartingRoom>
<StartX>160</StartX>
<StartY>120</StartY>
<StartingRoom>2</StartingRoom>
<StartX>117</StartX>
<StartY>222</StartY>
<UniformMovementSpeed>True</UniformMovementSpeed>
<MovementSpeed>3</MovementSpeed>
<MovementSpeedX>0</MovementSpeedX>
Expand Down Expand Up @@ -2344,32 +2344,32 @@
<SpriteFolder Name="Walk">
<SubFolders />
<Sprites>
<Sprite Slot="81" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="81" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-run-00.png</FileName>
</Source>
</Sprite>
<Sprite Slot="82" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="82" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-run-01.png</FileName>
</Source>
</Sprite>
<Sprite Slot="83" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="83" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-run-02.png</FileName>
</Source>
</Sprite>
<Sprite Slot="84" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="84" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-run-03.png</FileName>
</Source>
</Sprite>
<Sprite Slot="85" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="85" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-run-04.png</FileName>
</Source>
</Sprite>
<Sprite Slot="86" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="86" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-run-05.png</FileName>
</Source>
Expand Down Expand Up @@ -2469,7 +2469,7 @@
<SpriteFolder Name="Hit">
<SubFolders />
<Sprites>
<Sprite Slot="103" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="103" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>img/enemy2/enemy2-hit-00.png</FileName>
</Source>
Expand All @@ -2479,22 +2479,22 @@
<SpriteFolder Name="Throw">
<SubFolders />
<Sprites>
<Sprite Slot="104" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="104" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>Z:\home\erico\Documents\dogfromhell\img\enemy2\enemy2-throw-00.png</FileName>
</Source>
</Sprite>
<Sprite Slot="105" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="105" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>Z:\home\erico\Documents\dogfromhell\img\enemy2\enemy2-throw-01.png</FileName>
</Source>
</Sprite>
<Sprite Slot="106" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="106" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>Z:\home\erico\Documents\dogfromhell\img\enemy2\enemy2-throw-02.png</FileName>
</Source>
</Sprite>
<Sprite Slot="107" Width="70" Height="70" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Sprite Slot="107" Width="50" Height="52" ColorDepth="32" Resolution="LowRes" AlphaChannel="True">
<Source>
<FileName>Z:\home\erico\Documents\dogfromhell\img\enemy2\enemy2-throw-03.png</FileName>
</Source>
Expand Down Expand Up @@ -5878,6 +5878,148 @@
</Loop>
</Loops>
</View>
<View>
<ID>21</ID>
<Name>Enemy2Throw</Name>
<Loops>
<Loop>
<ID>0</ID>
<RunNextLoop>False</RunNextLoop>
<Frames>
<ViewFrame>
<ID>0</ID>
<Image>104</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>1</ID>
<Image>105</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>2</ID>
<Image>106</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>3</ID>
<Image>107</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
</Frames>
</Loop>
<Loop>
<ID>1</ID>
<RunNextLoop>False</RunNextLoop>
<Frames>
<ViewFrame>
<ID>0</ID>
<Image>104</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>1</ID>
<Image>105</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>2</ID>
<Image>106</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>3</ID>
<Image>107</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
</Frames>
</Loop>
<Loop>
<ID>2</ID>
<RunNextLoop>False</RunNextLoop>
<Frames>
<ViewFrame>
<ID>0</ID>
<Image>104</Image>
<Flipped>True</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>1</ID>
<Image>105</Image>
<Flipped>True</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>2</ID>
<Image>106</Image>
<Flipped>True</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>3</ID>
<Image>107</Image>
<Flipped>True</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
</Frames>
</Loop>
<Loop>
<ID>3</ID>
<RunNextLoop>False</RunNextLoop>
<Frames>
<ViewFrame>
<ID>0</ID>
<Image>104</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>1</ID>
<Image>105</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>2</ID>
<Image>106</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
<ViewFrame>
<ID>3</ID>
<Image>107</Image>
<Flipped>False</Flipped>
<Delay>0</Delay>
<Sound>0</Sound>
</ViewFrame>
</Frames>
</Loop>
</Loops>
</View>
</Views>
</ViewFolder>
</SubFolders>
Expand Down
86 changes: 81 additions & 5 deletions Gameatic.asc
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
// new module script
int bonePileCount;
Timer * t_killMember;
Timer * t_enemy2[50]; //time throwing
Timer * t_enemy2_whenToStartThrow[50]; //this number is only big enough to not crash
Timer * t_enemy2_throw[50]; //this number is only big enough to not crash

int destination_left;
int destination_right;

function game_start(){
function game_start()
{
destination_left = 24 ;
destination_right = Room.Width - 40;
destination_right = 224 - 24;
}

void checkWinCondition(){
if(bonePileCount >= 3){
// damn you cute player, you won!

Wait(SecondsToLoops(1.0));

if(player.Room == 1){
player.ChangeRoom(2, 21, 284, eDirectionRight);
}
}
}

bool isDogWithBonne(){
Expand Down Expand Up @@ -56,6 +72,7 @@ void resetBonePile(){
int incrementBonePile(){
bonePileCount++;
updateBonePileGraphic();
checkWinCondition();
}

void dogHitBonePile(){
Expand Down Expand Up @@ -145,7 +162,6 @@ void ChompEnemy(Character * enemy){
enemy.LockView(ENEMY2HIT, eStopMoving);
}


gBlood.SetPosition(cDog.x - x_off, cDog.y - y_off);

gBlood.Visible = true;
Expand Down Expand Up @@ -182,14 +198,14 @@ void ChompEnemy(Character * enemy){

void DoChompOrHit(Character * enemy){

if((cDog.Loop == 1 && (cDog.Moving == false || !KeyboardMovement.Moving() )) &&
if((cDog.Loop == 1 && (cDog.Moving == false && !KeyboardMovement.Moving() )) &&
(enemy.DestinationX == destination_left && enemy.Moving)){
// dog is stopped looking left &
// enemy is going left

dogTookEnemyHit();

} else if((cDog.Loop != 1 && (cDog.Moving == false || !KeyboardMovement.Moving() )) &&
} else if((cDog.Loop != 1 && (cDog.Moving == false && !KeyboardMovement.Moving() )) &&
(enemy.DestinationX == destination_right && enemy.Moving)){
// dog is stopped looking right &
// enemy is going right
Expand Down Expand Up @@ -220,6 +236,62 @@ void dealWithEnemy1(Character * enemy1){
}
}

// enemy walks around and occasionally pauses to throw letters
void dealWithEnemy2(Character * enemy2){
if(t_enemy2_whenToStartThrow[enemy2.ID] != null && t_enemy2_whenToStartThrow[enemy2.ID].EvtExpired){
t_enemy2_whenToStartThrow[enemy2.ID] = null;

t_enemy2[enemy2.ID] = Timer.StartRT(3.0, eOnce);
}


if(t_enemy2[enemy2.ID] != null && t_enemy2[enemy2.ID].EvtExpired){
t_enemy2[enemy2.ID] = null;
if(enemy2.View == ENEMY2THROW){
enemy2.UnlockView();
}

enemy2.PlaceOnWalkableArea();
if(enemy2.Loop == 2){
//looking right
enemy2.AddWaypoint(destination_right, enemy2.y);
} else {
//looking left maybe
enemy2.AddWaypoint(destination_left , enemy2.y);
}


}

if(t_enemy2[enemy2.ID] != null && enemy2.View != ENEMY2THROW){
enemy2.LockView(ENEMY2THROW, eStopMoving);
enemy2.Animate(enemy2.Loop, 4, eRepeat, eNoBlock);
} else if(t_enemy2[enemy2.ID] != null && enemy2.View == ENEMY2THROW) {

} else {
if(t_enemy2_whenToStartThrow[enemy2.ID] == null ){
t_enemy2_whenToStartThrow[enemy2.ID] = Timer.StartRT(3.0, eOnce);
}


if(enemy2.DestinationX == destination_left && enemy2.Moving){

} else if(enemy2.DestinationX == destination_right && enemy2.Moving){

} else if(enemy2.x == destination_left && enemy2.View != ENEMY1HIT){
enemy2.AddWaypoint(destination_right, enemy2.y);
} else if(enemy2.x == destination_right && enemy2.View != ENEMY1HIT) {
enemy2.AddWaypoint(destination_left , enemy2.y);
}

}


if(enemy2.IsCollidingWithChar(cDog)){
DoChompOrHit(enemy2);
}
}

void checkBonePileRepExe(){
if(cBonePile.IsCollidingWithChar(cDog)){
dogHitBonePile();
Expand All @@ -231,6 +303,10 @@ void init_enemy1(Character * enemy1){
enemy1.AddWaypoint(destination_left, enemy1.y);
}

void init_enemy2(Character * enemy2){
enemy2.AddWaypoint(destination_left, enemy2.y);
}

void repeatedly_execute(){
if(t_killMember!=null && t_killMember.EvtExpired){
gLegs1.UnlockView();
Expand Down
Loading

0 comments on commit f6f193f

Please sign in to comment.