void BlitFrame(int x, int y, anim_t anim, int frame, Blitter b) { if (frame > anim.numframes) return; int frametop = anim.sizey * frame; b.BlitSubrect(anim.image, 0, frametop, anim.sizex, anim.sizey, x, y); }
void BlitFrameAt(int x, int y, anim_t anim, int frame, Blitter b) { if (frame > anim.numframes) return; //if (frame == anim.bufferedframe) int frametop = anim.sizey * frame; b.BlitSubrect(anim.image, 0, frametop, anim.sizex, anim.sizey, x-anim.sizex/2, y-anim.sizey/2); }
void InitializeSlug(int r) { slug_x = Random(10, 310); slug_y = 220; spr_state = SPR_SLUG; spr_die = systemtime + 600; spritetimer = 0; switch (r) { case 0: slug_spr = sluggy; break; case 1: slug_spr = sluggy2; break; } }
anim_t LoadAnimation(string filename, int sizex, int sizey) { // load up this animation, detect number of frames anim_t anim = new anim_t(); anim.image = LoadImage0(filename); anim.active = 1; anim.sizex = sizex; anim.sizey = sizey; anim.numframes = anim.image.Height / sizey; anim.bufimage = NewImage(sizex, sizey); anim.bufferedframe = null; return anim; }
void InitializeFish(int r) { int i; for (i = 0; i < NUM_FISHIES; i++) { fishies[i].x = Random(330, 630); fishies[i].y = Random(50, 140); fishies[i].angleofs = Random(0, 359); } switch (r) { case 0: fishspr = fish; break; case 1: fishspr = fish2; break; } spr_state = SPR_FISH; spr_die = systemtime + 1400; spritetimer = 0; }
void InitializeWeather(int i) { switch (i) { case 0: wspr = rain; break; case 1: wspr = snow; break; } for (i = 0; i < NUM_NODES; i++) { wnodes[i].x = Random(0, 320); wnodes[i].y = Random(0, 200); wnodes[i].layer = Random(0, 2); wnodes[i].starttime = systemtime + Random(0, 100); wnodes[i].endtime = systemtime + Random(700, 800); } spr_state = SPR_WEATHER; spr_die = systemtime + 800; spritetimer = 0; }
void InitializeLeaves(int i) { switch (i) { case 0: lspr = leaf; break; case 1: lspr = leaf2; break; case 2: lspr = heart; break; } for (i = 0; i < NUM_LEAVES; i++) { leaves[i].x = Random(0, 320) * 16; leaves[i].y = Random(0, 200) * 16; leaves[i].angle = Random(0, 359); leaves[i].starttime = systemtime + Random(0, 150); leaves[i].endtime = systemtime + Random(650, 800); } spr_state = SPR_LEAVES; spr_die = systemtime + 800; spritetimer = 0; }
void InitializeFlyer(int r) { switch (r) { case 0: flyer_sprite = flyeye; break; case 1: flyer_sprite = flymask; break; case 2: flyer_sprite = flyskull; break; case 3: flyer_sprite = flyheart; break; case 4: flyer_sprite = flyeyeg; break; } r = Random(0, 1); switch (r) { case 0: fly_dir = 0 - 1; fly_y = 220; break; case 1: fly_dir = 1; fly_y = 0 - 20; break; } fly_x = Random(50, 270); spr_state = SPR_FLY; spr_die = systemtime + 1000; spritetimer = 0; }
void LoadResources() { sluggy = LoadAnimation("sprites/sluggy.png", 17, 30); sluggy2 = LoadAnimation("sprites/slug_brown.png", 17, 30); leaf = LoadAnimation("sprites/leafie.png", 14, 10); leaf2 = LoadAnimation("sprites/leaf_green.png", 14, 10); heart = LoadAnimation("sprites/hearts.png", 14, 10); fish = LoadAnimation("sprites/fishie.png", 19, 17); fish2 = LoadAnimation("sprites/fish2.png", 19, 17); flymask = LoadAnimation("sprites/flymask.png", 71, 26); flyskull = LoadAnimation("sprites/flyskull.png", 71, 26); flyeye = LoadAnimation("sprites/flyeye.png", 71, 26); flyeyeg = LoadAnimation("sprites/flyeye_green.png", 71, 26); flyheart = LoadAnimation("sprites/flyheart.png", 71, 26); snow = LoadAnimation("sprites/snow.png", 4, 4); rain = LoadAnimation("sprites/raindrop.png", 6, 6); flame = LoadAnimation("sprites/flame.png", 8, 8); halo = LoadAnimation("sprites/halo.png", 144, 144); bigeye = LoadImage0("sprites/bigeye.png"); bigeyeg = LoadImage0("sprites/bigeye_green.png"); bigheart = LoadImage0("sprites/bigheart.png"); bigsmile = LoadImage0("sprites/bigsmile.png"); evilmask = LoadImage0("sprites/evilmask.png"); flower = LoadImage0("sprites/flower.png"); hourglass = LoadImage0("sprites/hourglass.png"); moon = LoadImage0("sprites/moon.png"); planet = LoadImage0("sprites/planet.png"); skull = LoadImage0("sprites/skullofawesome.png"); smalleye = LoadImage0("sprites/smalleye.png"); tinyeye = LoadImage0("sprites/tinyeye.png"); smile = LoadImage0("sprites/smallsmile.png"); smile2 = LoadImage0("sprites/smile_green.png"); sun = LoadImage0("sprites/sun.png"); candle = LoadImage0("sprites/candle.png"); clock = LoadImage0("sprites/smallclock.png"); // Background Images facered = LoadImage0("background/face_red.png"); faceblue = LoadImage0("background/face_blue.png"); facegreen = LoadImage0("background/face_green.png"); sphereblue = LoadImage0("background/sphereblue.png"); spheregreen = LoadImage0("background/spheregreen.png"); spheregrey = LoadImage0("background/spheregrey.png"); sphereorange = LoadImage0("background/sphereorange.png"); spherepurple = LoadImage0("background/spherepurple.png"); lightning = LoadImage0("background/lightning.png"); bobblue = LoadImage0("background/bobblue.png"); bobgreen = LoadImage0("background/bobgreen.png"); bobred = LoadImage0("background/bobred.png"); bobpurple = LoadImage0("background/bobpurple.png"); tiledbg0 = LoadImage0("background/tiledbg0.png"); tiledbg1 = LoadImage0("background/tiledbg1.png"); tiledbg2 = LoadImage0("background/tiledbg2.png"); tiledbg3 = LoadImage0("background/tiledbg3.png"); tiledbg4 = LoadImage0("background/tiledbg4.png"); tiledbg5 = LoadImage0("background/tiledbg5.png"); tiledbg6 = LoadImage0("background/tiledbg6.png"); tiledbg7 = LoadImage0("background/tiledbg7.png"); tiledbg8 = LoadImage0("background/tiledbg8.png"); tiledbg9 = LoadImage0("background/tiledbg9.png"); grad1 = LoadImage0("background/_grad1.png"); grad2 = LoadImage0("background/_grad2.png"); grad3 = LoadImage0("background/_grad3.png"); grad4 = LoadImage0("background/_grad4.png"); grad5 = LoadImage0("background/_grad5.png"); grad6 = LoadImage0("background/_grad8.png"); grad7 = LoadImage0("background/_grad7.png"); grad8 = LoadImage0("background/_grad8.png"); evilgrad1 = LoadImage0("background/evilgrad.png"); evilgrad2 = LoadImage0("background/evilgd1.png"); evilgrad3 = LoadImage0("background/evilgd2.png"); evilgrad4 = LoadImage0("background/evilgrad3.png"); halo.image.Alphafy(Color.Magenta); bgalpha = NewImage(256, 256); }