Hi!
I'm having problems here. I've made this little game in which things are being conveyed downwards with the help of conveyer belts, and one is to collect as much as possible. Now, somethings when collected just give you points, others actually are teleported to you.
But there is a problem in what it teleports. At times, it decides to teleport objects that are in the player's sector as well. Why?
I'm having problems here. I've made this little game in which things are being conveyed downwards with the help of conveyer belts, and one is to collect as much as possible. Now, somethings when collected just give you points, others actually are teleported to you.
But there is a problem in what it teleports. At times, it decides to teleport objects that are in the player's sector as well. Why?
Code:
# OK... Originally thought of Tetris, but couldn't quite think in those terms. # So it became something else, but still with the annoying Tetris song... # You can mute it if you want... # # By Edward flags=0x240 symbols message startup message activated message pulse message arrived thing console thing above thing creator thing rope0 thing rope2 thing elev0 mask=-1 thing elev1 mask=-1 thing elev2 mask=-1 thing elev3 mask=-1 thing elev4 mask=-1 thing elev5 mask=-1 thing elev6 mask=-1 thing elev7 mask=-1 template x thing xx local template smallcrate0 template smallcrate1 template smallcrate2 template smallcrate3 template smallcrate4 template smallcrate5 template smallcrate6 template smallcrate7 template smallcrate8 template smallcrate9 template smallcrate10 template smallcrate11 template powerup0 template powerup1 template powerup2 template powerup3 template powerup4 template powerup5 template powerup6 template powerup7 template powerup8 template powerup9 template powerup10 template powerup11 template powerup12 template powerup13 template powerup14 model SmallRough model LongCrate model PentCrate model SmallBlack model MedBlack model BigBlack model MetalCrate model WoodenCrate model Shrap model BattleDroid model DestDroid model Ugnaut model elev surface scone surface scten surface schun sound crash sound boom sound bang sound smash sound wham sound ug sound bd sector gamearea cog music int i local int j local thing z local thing zx local int in=0 local int score=0 local thing player local end # code startup: SetPulse(0); in=0; for(i=0; i<8; i=i+1) MoveToFrame(elev0, 0, 100); return; activated: If(GetSenderRef()!=console) return; if(in==1) return; if(GetCurrentCamera()==1) CycleCamera(); SetSectorThrust(gamearea, '0 1 0', 1000); SetCameraFocus(0, above); player=GetSourceRef(); SetActorFlags(player, 0x800000); MoveToFrame(creator, rand()*12, 1+rand()+score); score=0; in=1; SelectWeapon(player, 1); sleep(0.25); SetCurInvWeapon(player, 0); SelectWeapon(player, 0); xx=FireProjectile(player, x, -1, -1, '0 0 0', '0 0 0', 0, 0, 0, 0); CaptureThing(xx); SetLifeLeft(xx, 0); SetPulse(0.01); SetSectorThrust(gamearea, '0 1 0', 0); return; pulse: AttachThingToThing(rope2, rope0); SetCollideType(rope0, 0); SetCollideType(rope2, 0); if(VectorY(GetThingThrust(player))>0) { If(GetCurFrame(rope0)==0) return; if(IsMoving(rope0)) return; MoveToFrame(rope0, GetCurFrame(rope0)-1, 8); } else if(VectorY(GetThingThrust(player))<0) { If(GetCurFrame(rope0)==3) return; if(IsMoving(rope0)) return; MoveToFrame(rope0, GetCurFrame(rope0)+1, 8); } else if(VectorX(GetThingThrust(player))>0) { if(IsMoving(elev0[(GetCurFrame(rope0)*2)])) return; MoveToFrame(elev0[(GetCurFrame(rope0)*2)], 1, 4); } else if(VectorX(GetThingThrust(player))<0) { if(IsMoving(elev0[(GetCurFrame(rope0)*2)+1])) return; MoveToFrame(elev0[(GetCurFrame(rope0)*2)+1], 1, 4); } if(GetCurrentCamera()==1) { SetCameraFocus(0, player); ClearActorFlags(player, 0x800000); SetPulse(0); in=0; StopThing(creator); SelectWeapon(player, 1); DestroyThing(xx); } if(GetCurWeapon(player)==1) { SendMessage(music, user0); SetCurInvWeapon(player, 0); SelectWeapon(player, 0); } TeleportThing(player, xx); SetWallCel(scone, score%10); SetWallCel(scten, (score%100)/10); SetWallCel(schun, score/100); return; arrived: if(in==0) return; for(i=0; i<8; i=i+1) { if(GetSenderRef()==elev0) { if(GetCurFrame(elev0)==1) { MoveToFrame(elev0, 0, 4); } else if(GetCurFrame(elev0)==0) { z=FirstThingInSector(GetThingSector(elev0)); for(j=0; j<=GetSectorThingCount(GetThingSector(elev0)); j=j+1) { if(GetThingModel(z)==SmallRough) { PlaySoundThing(bang, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(15-i); } else if(GetThingModel(z)==LongCrate) { PlaySoundThing(bang, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(10-i); } else if(GetThingModel(z)==PentCrate) { PlaySoundThing(boom, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(5-(i/2)); } else if(GetThingModel(z)==SmallBlack) { PlaySoundThing(boom, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(1); } else if(GetThingModel(z)==MedBlack) { PlaySoundThing(crash, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(5); } else if(GetThingModel(z)==BigBlack) { PlaySoundThing(wham, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(10); } else if(GetThingModel(z)==MetalCrate) { PlaySoundThing(boom, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(10-i); } else if(GetThingModel(z)==WoodenCrate) { PlaySoundThing(boom, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(10-i); } else if(GetThingModel(z)==Shrap) { PlaySoundThing(smash, elev0, 1, -1, 20, 0x0); DestroyThing(z); DamageThing(player, rand()*10, 0x41, player); } else if(GetThingModel(z)==BattleDroid) { PlaySoundThing(bd, elev0, 1, -1, 20, 0x0); TeleportThing(z, player); score=score+(-10-i); } else if(GetThingModel(z)==DestDroid) { PlaySoundThing(bd, elev0, 1, -1, 20, 0x0); TeleportThing(z, player); score=score+(-20-i); } else if(GetThingModel(z)==Ugnaut) { PlaySoundThing(ug, elev0, 1, -1, 20, 0x0); DestroyThing(z); score=score+(-10-i); } else if(GetThingModel(z)==elev) { return; } else { PlaySoundThing(boom, elev0, 1, -1, 20, 0x0); TeleportThing(z, player); score=score+(10+(rand()*10)-i); } z=NextThingInSector(z); } SetSectorThrust(GetThingSector(elev0), '0 0 1', 1000); } } } if(GetSenderRef()==creator) { if(rand()<.5) { zx=CreateThing(smallcrate0[rand()*11], creator); if(( (GetThingModel(zx)!=Ugnaut) || (GetThingModel(zx)!=BattleDroid) || (GetThingModel(zx)!=DestDroid) ) && ( (GetThingModel(zx)==SmallRough) || (GetThingModel(zx)==LongCrate) || (GetThingModel(zx)==PentCrate) || (GetThingModel(zx)==SmallBlack) || (GetThingModel(zx)==MedBlack) || (GetThingModel(zx)==BigBlack) )) ParseArg(zx, "orient=(0.000000/0.000000/0.000000) type=debris collide=1 move=physics movesize=0.010000 surfdrag=3.000000 airdrag=1.000000 mass=25.000000 height=0.011000 physflags=0x404041 buoyancy=0.500000 thingflags=0x0 cog=none"); } else if(rand()>.5) { CreateThing(powerup0[rand()*14], creator); } MoveToFrame(creator, rand()*12, 1+rand()+score); } return; end