⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paths.h

📁 symbian 的一个 二维飞行游戏 源码 及相关技术文章
💻 H
📖 第 1 页 / 共 2 页
字号:
// Copyright 2002 Kenneth Guy,
// 
#include "TPathLineType.h"
#include "TBadGuyFlags.h"

//0   home in from behind bad guy
//1   recovering bad guy
//2   zig zag bad guy
//3   bouncing animated bad guy
//4   homing bullet powerup
//5   homing then rocket bad guy
//6   cloning bad guy


extern const TInt16 KPaths[]={
  // path 0 run along the top move down behind player then home in on player
  EPathLineStart,1,0,0,
  EPathLineMoveTo,1,270,0,
  EPathLineSetVelocity,1,2,2,
  EPathLineMoveStepTo,1,30,0,
  EPathLineMoveStepTo,1,30,90,
  EPathLineSetClearFlags,1,  TBadGuyFlags::EHomingX    |
                             TBadGuyFlags::EHomingY, 0,
  EPathLineMoveSimple,0,0,0,

  // path 1
  // Bad guy that is larger if iHealth is greater
  // also gains one health every 8 frames so if the player leaves
  // it alone it recovers.
  EPathLineStart,1,0,0,
  EPathLineSetHealth,1,2,0,
  EPathLineSetSprite,1,55,0,
  EPathLineSetClearFlags,1,  TBadGuyFlags::EBounceTop    |
                             TBadGuyFlags::EBounceBottom |
                             TBadGuyFlags::EBounceLeft   |
                             TBadGuyFlags::EBounceRight,0,
  EPathLineSetVelocity,1,1,1,
  EPathLineSetCounter,1,0,0,  // loop2, reset counter to 0
  EPathLineIfHealthEqual,2,1,1, // set sprite depending on health, loop1
  EPathLineSetSprite,1,54,0,
  EPathLineIfHealthEqual,2,1,2,
  EPathLineSetSprite,1,55,0,
  EPathLineIfHealthEqual,2,1,3,
  EPathLineSetSprite,1,56,0,
  EPathLineIfHealthEqual,2,1,4,
  EPathLineSetSprite,1,57,0,
  EPathLineIfHealthEqual,2,1,5,
  EPathLineSetSprite,1,58,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineAddCounter,1,1,0, // add one to counter
  EPathLineIfCounterLess,1,-12,8, // if counter < 8 goto loop1
  EPathLineIfHealthLess,-14,1,5, // if health >= 5 goto loop2
  EPathLineAddHealth,-15,1,0, // add 1 to health and goto loop2
  
  // path 2  zig zag path
  EPathLineStart,1,0,0,
  EPathLineSetCounter,1,0,0, //looppoint1, reset counter to 0
  EPathLineMoveBy,1,-2,+2,
  EPathLineAddCounter,1,1,0, // add one to counter
  EPathLineIfCounterLess,1,-2,32, // goto looppoint1 if < 32
  EPathLineSetCounter,1,0,0, //looppoint2, reset counter to 0
  EPathLineMoveBy,1,0,-2,
  EPathLineAddCounter,1,1,0, // add one to counter
  EPathLineIfCounterLess,-7,-2,32, // goto looppoint2 if < 32 else goto 1


  // path 3, bouncing animated bad guy
  EPathLineStart,1,0,0,
  // path offset 64
  // set up velocity and bouncing
  EPathLineSetVelocity,1,-1,1, 
  EPathLineSetClearFlags,1,  TBadGuyFlags::EBounceTop    |
                             TBadGuyFlags::EBounceBottom |
                             TBadGuyFlags::EBounceLeft   |
                             TBadGuyFlags::EBounceRight, 0,
  // loop bouncing and changing sprites
  EPathLineSetSprite,1,16,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,31,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,32,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,33,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,32,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,31,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,-17,0,0,

  // path 4 animated homing gold ring
  EPathLineStart,1,0,0,
  EPathLineSetVelocity,1,1,1, 
  EPathLineSetClearFlags,1,  TBadGuyFlags::EHomingX    |
                             TBadGuyFlags::EHomingY, 0,
  EPathLineSetSprite,1,19,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,20,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,59,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,60,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,59,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,20,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,-17,0,0,

  // path 5, homing then rocket bad guy
  EPathLineStart,1,0,0,
  // path offset 94
  EPathLineSetVelocity,1,1,2,
  EPathLineSetClearFlags,1,  TBadGuyFlags::EHomingY, 0,
  EPathLineSetSprite,1,35,0,
  EPathLineSetCounter,1,0,0, 
  EPathLineMoveSimple,1,0,0,
  EPathLineAddCounter,1,1,0,
  EPathLineIfCounterLess,1,-2,28, // loop homing in for 28 frames
  EPathLineSetSprite,1,36,0, // then change shape
  EPathLineMoveSimple,1,0,0, // bit more homing
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,37,0, // then shoot left animating
  EPathLineMoveBy,1,-6,0,
  EPathLineSetSprite,1,38,0,
  EPathLineMoveBy,-3,-6,0,


  // path 6, bad guy that sends out small bad guys
  EPathLineStart,1,0,0,
  EPathLineSetVelocity,1,0,1, 
  EPathLineSetPoints,1,50,0,  
  EPathLineSetHealth,1,6,0,
  EPathLineSetSprite,1,48,0,
  EPathLineSetClearFlags,1,  TBadGuyFlags::EBounceTop    |
                             TBadGuyFlags::EBounceBottom |
                             TBadGuyFlags::EBounceLeft   |
                             TBadGuyFlags::EBounceRight, 0,
  EPathLineSetCounter,1,0,0,  
  EPathLineMoveSimple,1,0,0,
  EPathLineAddCounter,1,1,0,
  EPathLineIfCounterLess,1,-2,14, // loop for 14 frames
  EPathLineSetSprite,1,48,0, // then animate creation of new bad guy
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,49,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,50,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,51,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,52,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineSetSprite,1,53,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineMoveSimple,1,0,0,
  EPathLineClone,-25,1,0,     // clone new bad guy and loop back

  EPathLineSetSprite,1,47,0,  // cloned version
  EPathLineSetPoints,1,2,0,  
  EPathLineSetVelocity,1,-2,2,  
  EPathLineSetId,1,0,0,        // remove id, kill this doesn't damage parent
  EPathLineSetHealth,1,1,0, 
  EPathLineSetClearFlags,1,  TBadGuyFlags::EBounceTop    |
                             TBadGuyFlags::EBounceBottom |
                             TBadGuyFlags::EBounceLeft, TBadGuyFlags::EBounceRight,
  EPathLineMoveSimple,0,0,0, // repeat move simple forever
  
  // path 7, stream of 10 bad guys
  EPathLineStart,1,0,0,
  EPathLineSetCounter,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineClone,1,5,0,
  EPathLineAddCounter,1,1,0,
  EPathLineIfCounterLess,1,-8,15,  // clone my self 15 times then die,
  EPathLineSetPoints,1,0,0,
  EPathLineSetHealth,0,0,0, // die

  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-4,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-4,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-1,2,
  EPathLineMoveBy,1,-1,3,
  EPathLineMoveBy,1,-1,4,
  EPathLineMoveBy,1,-2,5,
  EPathLineMoveBy,1,-1,4,
  EPathLineMoveBy,1,-1,4,
  EPathLineMoveBy,1,-4,2,
  EPathLineMoveBy,1,-4,3,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-2,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-4,-3,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-3,-2,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-3,-2,
  EPathLineMoveBy,1,-2,3,
  EPathLineMoveBy,1,-3,3,
  EPathLineMoveBy,1,-1,2,
  EPathLineMoveBy,1,-2,3,
  EPathLineMoveBy,1,-1,2,
  EPathLineMoveBy,1,-2,3,
  EPathLineMoveBy,1,-3,4,
  EPathLineMoveBy,1,-4,5,
  EPathLineMoveBy,1,-4,3,
  EPathLineMoveBy,1,-5,3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,0,-2,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,0,-2,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,0,-4,
  EPathLineMoveBy,1,0,-2,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,-1,-2,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,0,-2,
  EPathLineMoveBy,1,-1,-3,
  EPathLineMoveBy,1,0,-1,
  EPathLineMoveBy,1,-1,-1,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-2,-4,
  EPathLineMoveBy,1,-2,-3,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,0,-3,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,1,-1,-4,
  EPathLineMoveBy,-105,0,-3,

  // path 8, worm with 8 segments
  EPathLineStart,1,0,0,
  
  EPathLineClone,1,14,0,
  EPathLineClone,1,15,0,
  EPathLineClone,1,16,0,
  EPathLineClone,1,17,0,
  EPathLineClone,1,18,0,
  EPathLineClone,1,19,0,
  EPathLineClone,1,20,0,
  EPathLineClone,1,21,0,
  EPathLineClone,1,22,0,
  EPathLineClone,1,23,0,
  EPathLineClone,1,24,0,
  EPathLineSetSprite,1,56,0, // green head
  EPathLineClone,1,24,0,
  EPathLineSetHealth,0,0,0, // expire,


  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,

  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-2,0,
  EPathLineMoveBy,1,-2,0,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,1,
  EPathLineMoveBy,1,-2,0,
  EPathLineMoveBy,1,-2,0,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,1,-2,-1,
  EPathLineMoveBy,-31,-2,-1,


  // path 9, large ship first line
  EPathLineStart,1,0,0,
  EPathLineClone,1,7,0,
  EPathLineClone,1,8,0,
  EPathLineClone,1,9,0,
  EPathLineClone,1,10,0,
  EPathLineClone,1,11,0,

  EPathLineMoveBy,1,0,0,
  EPathLineSetSprite,27,61,0,
  EPathLineMoveBy,1,0,24,
  EPathLineSetSprite,25,64,0,
  EPathLineMoveBy,1,0,0,
  EPathLineSetSprite,15,62,0,
  EPathLineMoveBy,1,0,24,
  EPathLineSetSprite,13,65,0,
  EPathLineMoveBy,1,0,0,
  EPathLineSetSprite,3,63,0,
  EPathLineMoveBy,1,0,24,
  EPathLineSetSprite,1,66,0,

  EPathLineMoveBy,1,0,0, // (wait for first two sections to move on)
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,

  EPathLineMoveBy,1,0,0, // (wait for first section to move on)
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,

  EPathLineMoveBy,0,-2,0, // movement for whole section, must be relative


  //  MoveTo 230,224  // path 10

  // path 10,
  EPathLineStart,1,0,0,
  EPathLineSetCounter,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineMoveBy,1,0,0,
  EPathLineClone,1,5,0,
  EPathLineAddCounter,1,1,0,
  EPathLineIfCounterLess,1,-8,15,  // clone my self 15 times then die,
  EPathLineSetPoints,1,0,0,
  EPathLineSetHealth,0,0,0, // die

  EPathLineMoveBy,1,-1,-5,
  EPathLineMoveBy,1,-2,-5,
  EPathLineMoveBy,1,-2,-5,
  EPathLineMoveBy,1,-2,-5,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-2,-2,
  EPathLineMoveBy,1,-3,-2,
  EPathLineMoveBy,1,-3,-2,
  EPathLineMoveBy,1,-3,-3,
  EPathLineMoveBy,1,-3,-1,
  EPathLineMoveBy,1,-3,-1,
  EPathLineMoveBy,1,-3,-1,
  EPathLineMoveBy,1,-3,-1,
  EPathLineMoveBy,1,-2,2,
  EPathLineMoveBy,1,-2,3,
  EPathLineMoveBy,1,-2,3,
  EPathLineMoveBy,1,-3,3,
  EPathLineMoveBy,1,-2,3,
  EPathLineMoveBy,1,-3,4,
  EPathLineMoveBy,1,-3,4,
  EPathLineMoveBy,1,-3,4,
  EPathLineMoveBy,1,-3,-1,
  EPathLineMoveBy,1,-3,-2,
  EPathLineMoveBy,1,-3,-2,
  EPathLineMoveBy,1,-4,-2,
  EPathLineMoveBy,1,-1,-5,
  EPathLineMoveBy,1,-2,-6,
  EPathLineMoveBy,1,-2,-5,
  EPathLineMoveBy,1,-2,-6,
  EPathLineMoveBy,1,1,-6,
  EPathLineMoveBy,1,2,-6,
  EPathLineMoveBy,1,2,-6,
  EPathLineMoveBy,1,2,-7,
  EPathLineMoveBy,1,3,-3,
  EPathLineMoveBy,1,3,-4,
  EPathLineMoveBy,1,3,-3,
  EPathLineMoveBy,1,4,-4,
  EPathLineMoveBy,1,2,-3,
  EPathLineMoveBy,1,3,-4,
  EPathLineMoveBy,1,2,-4,
  EPathLineMoveBy,1,3,-4,
  EPathLineMoveBy,1,2,-5,
  EPathLineMoveBy,1,2,-5,
  EPathLineMoveBy,1,2,-5,
  EPathLineMoveBy,1,3,-6,
  EPathLineMoveBy,1,-1,-5,
  EPathLineMoveBy,1,-1,-6,
  EPathLineMoveBy,1,-1,-6,
  EPathLineMoveBy,1,-2,-6,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -