Posted By: Pappenheimer
jumper game code - 10/02/11 02:28
Nothing special, but I can't stop playing it, once I started it from SED.
Just copy it and save it as "jumper.c" or what ever to start it from SED.
No credits required. I'm not even sure, if there already was a similar contribution.
In case you are playing it, please tell me, if you find something annoying in it.
Questions or suggestions are surely welcome, as well.
Just copy it and save it as "jumper.c" or what ever to start it from SED.
No credits required. I'm not even sure, if there already was a similar contribution.
In case you are playing it, please tell me, if you find something annoying in it.
Questions or suggestions are surely welcome, as well.
Code:
#include <acknex.h> #include <default.c> var jump = 0; var right_left = 0; var height = 0; var height_level = 0; PANEL* height_level_pnl = { digits(20,20,4, Arial#24, 1, height_level); flags = SHOW; } function sky_color_func() { sky_color.blue = height_level; if(height_level > 255)sky_color.blue = 255; if(sky_color.blue < 0)sky_color.blue = 0; sky_color.red = height_level-150; if(height_level < 150)sky_color.red = 0; if(height_level > 405)sky_color.red = 255; sky_color.green = height_level-200; if(height_level < 200)sky_color.green = 0; if(height_level > 455)sky_color.green = 255; } function jumper() { wait(-1); player = my; jump = -2; camera.x -= 500; while(1) { camera.y = my.y; camera.z = my.z; if(my.z < 0){ my.z = 0; my.y = 0;} if(jump >= -12 * time_step) jump -= 1.6 * time_step;//has to be time corrected right_left = ((key_a - key_d) + (key_cul - key_cur) + (joy_1 - joy_4)) * 4.3; c_move(my, vector(0, right_left, 0), vector(0, 0, jump), IGNORE_MODELS); height_level = integer(my.z * 0.01); sky_color_func(); wait(1); } } function bouncer() { my.skill1 = height_level; set(my, PASSABLE); while(player == NULL){wait(1);} set(my, LIGHT); my.lightrange = 50; vec_set(my.blue,vector(random(255),random(255),random(255))); while(1) { if(vec_dist(player.x, my.x) < 15) { jump = 47*time_step;//time_step, only with restricted framerates // height_level = my.skill1; } wait(1); } } function main() { pan_setcolor(height_level_pnl,1,1,COLOR_RED); fps_max = 60; level_load(""); ent_create(SPHERE_MDL, vector(180,0,0), jumper); ent_create(CUBE_MDL, vector(180,0,0), bouncer); while(height < 50000) { height += 100; ent_create(CUBE_MDL, vector(180,random(120),height), bouncer); height_level += 1; } }