2 registered members (AndrewAMD, Ayumi),
1,395
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: dracula]
#247052
01/18/09 19:11
01/18/09 19:11
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Hi maslone1, thanks, I could have guessed that by looking through the code, but meh why should you always be the one that updates the code? I thought this is intended to be an open-source community project? Or is it not? cya xarthor
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: dracula]
#247177
01/19/09 11:39
01/19/09 11:39
|
Joined: Jul 2007
Posts: 424 EUROPE
maslone1
OP
Senior Member
|
OP
Senior Member
Joined: Jul 2007
Posts: 424
EUROPE
|
sorry, but i am not a god. I am just a little programer, grafic-artist, music-artist.... My plan: - Complete the other project (will be soon) About the 2.5 Spaceshooter: - Write a documentation for the script for better understanding - add functions to the ship cheers
Last edited by maslone1; 01/19/09 11:39.
A8c, Blender, FlStudio, Unity3d
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: maslone1]
#247187
01/19/09 12:15
01/19/09 12:15
|
Joined: Jul 2007
Posts: 424 EUROPE
maslone1
OP
Senior Member
|
OP
Senior Member
Joined: Jul 2007
Posts: 424
EUROPE
|
here u will find a little code description. hope it will help u. remember, a better documentation with a workshop will follow soon.
#include <acknex.h>
#include <default.c>
BMAP* star_map = "star.pcx";
var star_gen_pos[3]; //Starfield-Generator position
//Create a text on the left-top corner
//START//
TEXT* help = {
string = "TEST-PROGRAMM - CREATED BY MARCEL KLEE";
red = 255; green=255; blue=255;
flags=VISIBLE;
}
//END//
//////////////////////////////////////////////////////////
//Create Functions-Prototype//////////////////////////////
//////////////////////////////////////////////////////////
//START//
function plActor();
function part_alphafade(PARTICLE *p);
function effect_explo(PARTICLE *p);
//END//
function main(){
fps_max=60;
vec_set(screen_color,vector(1,1,1));
wait(1);
//Load the Environment
level_load("");
wait(3);
ent_create("s1.mdl", vector(0,0,0),plActor);
}
//////////////////////////////////////////////
/////////// PLAYER FUNCTION //////////////
//////////////////////////////////////////////
//The player-ship function
//START//
function plActor()
{
var vecPos[3] = {0,0,0}; //Position-Vector
var vecSpeed[3] = {0,0,0}; //Speed-Vector
var vecAng[3] = {0,0,0}; //Angular-Vector
//var vecForce1[3] = {0,0,0}; //Other force-Vectors ... function coming soon
var mySpeed = 0; //mySpeed describes the Engine-Force
var facCamAbst; //For the camera-distance to the playership -> only a factor x
var shipmass = 80; //80tons --- for the force calculation
while(1){
mySpeed += key_force.y*time_step/shipmass;
//calculate the effective force of the ship
//mySpeed adds the key_force (pressed = 1, not pressed = 0) * time_step / shipmass (80).
//The shipmass is only a factor. You can also say "hey the weight isn't 80tons, its 80 bannanas ;)
//For instance: Frame 1 -> mySpeed += 0*time_step/80 = 0. key not pressed = false
//For instance: Frame 2 -> mySpeed += 1*time_step/80 = 2,10. key pressed = true
//For instance: Frame 3 -> mySpeed += 1*time_step/80 = 2,10 + 2,10 = 4,20. ....and so on.....
//So how i use this "effective Force"?
//The effective Force only descripes the force we need to calculate a part of the speed vector.
//why only a part? -> there are maybe other forces. Maybe a collision with a other ship, or a explosion....
//We will see later.....
vecSpeed[1] += mySpeed*cos(my.pan);
vecSpeed[2] += mySpeed*sin(my.pan);
vecSpeed[3] = 0;
//Here we use the cos and sin function with mySpeed (we rember -> the effective force)
//to calculate the direction of the force + the force itself (vector-length)
//Attention! -> this will only calculate the vector for the engine-force.
//if we wanna use other forces, we have to write it again (or we write a function/macro)
vecAng[1] -= key_force.x*10*time_step;
//calculate the pan-angle for the player ship.
vec_add(vecPos[1], vecSpeed[1]);
//add the speed-vector to the position-vector of the ship.
accelerate(mySpeed, 0, 0.05);
accelerate(vecSpeed[1], 0, 0.05);
accelerate(vecSpeed[2], 0, 0.05);
accelerate(vecSpeed[3], 0, 0.05);
//its my way to simulate the friction.
//an other way: vecSpeed[1] *= vecSpeed*(0,95^time_step);
//i think it should also work.... i dont know yet.
my.pan = vecAng[1]; //nanonanet -> set my.pan to vecAng[1].
my.tilt = 0;
my.roll = 0;
my.x = vecPos[1]; //set my position to the vecPos.
my.y = vecPos[2];
my.z = vecPos[3];
camera.x = my.x; //set camera Position to my position
camera.y = my.y;
camera.z = my.z + 550 + facCamAbst; //my.z+550quants = the base-distance to my ship + factor facCamAbst
//facCamAbst is dynamic. (for instance speed * factor)
camera.tilt= -90; //camera look straight down to the ship.
camera.roll= 0;
camera.pan = 0;
facCamAbst = mySpeed*15*shipmass; //this is the "dynamic" camera factor.
facCamAbst = abs(facCamAbst);
vec_set(star_gen_pos[1],my.x);
//here we copy the my position information into the star_gen_pos vector.
effect(effect_explo,10 * time_step,star_gen_pos[1],normal);
//i use the particle effect generator for the starfield (i know, not the right name for this effect)
wait(1);
}
}
////////////////////////////////////
function part_alphafade(PARTICLE *p)
{
if(num_particles > 300) { p.lifespan -= 1*time_step; p.alpha -= 1*time_step; }
}
function effect_explo(PARTICLE *p)
{
var temp[3];
p.lifespan = random(500) - 200;
p.x = star_gen_pos[1] + random(600) - random(600);
p.y = star_gen_pos[2] + random(600) - random(600);
p.z = star_gen_pos[3] + random(600) - random(600);
p.size = random(8)-4;
p.alpha = 50 + random(25);
p.bmap = star_map;
p.flags |= (BRIGHT | TRANSLUCENT);
p.event = part_alphafade;
}
cheers Marcel
A8c, Blender, FlStudio, Unity3d
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: maslone1]
#247210
01/19/09 14:00
01/19/09 14:00
|
Joined: Apr 2008
Posts: 437
dracula
Senior Member
|
Senior Member
Joined: Apr 2008
Posts: 437
|
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: dracula]
#249526
02/03/09 06:19
02/03/09 06:19
|
Joined: Jul 2007
Posts: 424 EUROPE
maslone1
OP
Senior Member
|
OP
Senior Member
Joined: Jul 2007
Posts: 424
EUROPE
|
Hey there!
I have some news:
I have changed the code. It is now "open-source-friendly". Now i'll write a workshop, to show you how to use the code, or to create new functions for the game. Maybe coming weekend, its ready for download.
ciao Marcel
A8c, Blender, FlStudio, Unity3d
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: maslone1]
#249921
02/04/09 20:46
02/04/09 20:46
|
Joined: Apr 2008
Posts: 437
dracula
Senior Member
|
Senior Member
Joined: Apr 2008
Posts: 437
|
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: dracula]
#250562
02/08/09 19:10
02/08/09 19:10
|
Joined: Jul 2007
Posts: 424 EUROPE
maslone1
OP
Senior Member
|
OP
Senior Member
Joined: Jul 2007
Posts: 424
EUROPE
|
deleted
Last edited by maslone1; 02/08/09 19:20.
A8c, Blender, FlStudio, Unity3d
|
|
|
Re: 2.5D Spaceshooter - OpenSource
[Re: dracula]
#250563
02/08/09 19:12
02/08/09 19:12
|
Joined: Jul 2007
Posts: 424 EUROPE
maslone1
OP
Senior Member
|
OP
Senior Member
Joined: Jul 2007
Posts: 424
EUROPE
|
i am back.... here is the latest version (sorry, but - without a workshop). But the workshop will follow. Also a little manual. Filefront download 2_5 Spaceshooter Now it is version V.0.1 Have fun with it! Cheers Marcel
Last edited by maslone1; 02/08/09 19:18.
A8c, Blender, FlStudio, Unity3d
|
|
|
|