SRL Archive - Other Scripts

3D Game (Finished!!!) + 3D drawer!


almost

2008-05-14 22:26:38

With the feedback from my first post, i decided what kind of game to make and i made it!
There will probably be much more I'll be adding on to this later, but i wanted to release it right after i finished.
It took me so long to make this because i kept testing out a level and just didn't stop playing.
I actually got kind of addicted to this.
And the 3D drawer is just an idea i came up with while making the game for fun.

Game-
Comes with instructions.
But the first few levels are basically just boring so you can set it to start out on a higher level.

3D Drawer-
This was my attempt to make things 3 dimensional without using much trigonometry, instead trying to do it like a painting using perspective and have a vanishing point.
I can't get the "z" attribute to work exactly right like it should, it just kind of makes the object bigger or smaller.

Go under the "Add" button to add objects.
Click "Add Object" and it will stick it on there.
To change where it is, the angle, etc. just check one of the circle buttons off to the right and then use the up down left right buttons to move the object.
You'll catch on to it after a minute.

The "Get Code" button-
This turns your artwork into code that can be shown to other people.
You take that code and go to the very end of the script and paste it (you will see where it says to paste it)
Here is an example i made-
begin
SetArrayLength(Boxes, 8);
with Boxes[1] do
begin
cx:= 339;
cy:= 250;
x:= 29;
y:= 418;
z:= 50;
Angle:= 90;
Height:= 566;
Width:= 189;
Color:= 0;
end;
with Boxes[2] do
begin
cx:= 339;
cy:= 250;
x:= 29;
y:= 119;
z:= 50;
Angle:= 0;
Height:= 249;
Width:= 187;
Color:= 0;
end;
with Boxes[3] do
begin
cx:= 339;
cy:= 250;
x:= 644;
y:= 119;
z:= 50;
Angle:= 0;
Height:= 249;
Width:= 187;
Color:= 0;
end;
with Boxes[4] do
begin
cx:= 339;
cy:= 250;
x:= 644;
y:= 119;
z:= 50;
Angle:= 0;
Height:= 249;
Width:= 187;
Color:= 0;
end;
with Boxes[5] do
begin
cx:= 339;
cy:= 250;
x:= 31;
y:= 119;
z:= 50;
Angle:= 90;
Height:= 562;
Width:= 185;
Color:= 0;
end;
with Boxes[6] do
begin
cx:= 339;
cy:= 250;
x:= 644;
y:= 119;
z:= 50;
Angle:= 255;
Height:= 268;
Width:= 182;
Color:= 0;
end;
with Boxes[7] do
begin
cx:= 339;
cy:= 250;
x:= 30;
y:= 119;
z:= 50;
Angle:= -255;
Height:= 268;
Width:= 182;
Color:= 0;
end;
Objects:= 7;
SafeInitForm;
SafeShowFormModal;
FreeForm(frmDesign);
end.

Post your codes here!

\/ 3D is the game with a bug in it
3D Box is the 3D drawer
3D crash fix is the new version of the game, dl this one and PLEASE tell me if you get the bug and what happens during it.

Bobarkinator

2008-05-14 22:43:42

Nice job, the game is great.


However I crashed SCAR doing it :)

Scaper

2008-05-14 22:45:46

gj good game lol

i also crashed scar :D

almost

2008-05-14 22:48:36

Well can i get details on this and fix it?
Because i've never crashed SCAR on this.

Scaper

2008-05-14 22:50:47

no its nothing wrong with the script it jus my slow laggy comp

almost

2008-05-14 22:56:27

Try changing the DrawSpeed from 70 to something higher.

ShowerThoughts

2008-05-15 00:53:55

when died,
the rerty button flickered so it kinda crashed because i had to restart

Waddo

2008-05-15 03:26:58

wd try make more detailed pc like of a plasic ar masn that can be rotated then you realy will be onto something big

but wfd keep up with this

shud teach how to do so it can get developed faster

Dan Cardin

2008-05-15 07:09:06

i also crashed. but its awesome nonetheless

some things i dont like is that since you change your angle when you move, you should have the blocks be 3dimentional, cuz its kind of hard to hit 2d stuff. another is you cant see the stuff you're shooting, unless you hit them, when it makes the yellow circle. lastly, you should make it more visible when you get hit, cuz i think i died and didnt know it :p. all of those are minor things, so great job! :)

Camaro'

2008-05-15 09:01:56

Good job, i got the hang of it but its too hard to make something..

GoF

2008-05-15 11:08:11

From: waddo
wd try make more detailed pc like of a plasic ar masn that can be rotated then you realy will be onto something big

but wfd keep up with this

shud teach how to do so it can get developed faster


I don't think SCAR could handle ALOT of detail.. This is "less detailed" and is already crashing for people :)

GJ anyhow.

Killerdou

2008-05-15 11:59:50

if you want some detail, you can only draw triangles which are actually visable, this is fairly simple, because if you devine all the points of the triangles clockwise, they will be visable when the 2d triangle is clockwise, if it is counterclockwise, it is on the back side of the object:)


Function Det3X3(Mat : Array of Array of Integer) : integer;
var
v1, v2, v3, v4, v5, v6 : integer;
begin
v1 := Mat[0][0] * Mat[1][1] * Mat[2][2];
v2 := Mat[0][2] * Mat[2][0] * Mat[2][1];
v3 := Mat[0][1] * Mat[1][2] * Mat[2][0];
v4 := Mat[0][2] * Mat[1][1] * Mat[2][0];
v5 := Mat[0][0] * Mat[1][2] * Mat[2][1];
v6 := Mat[0][1] * Mat[1][0] * Mat[2][2];
Result := v1 + v2 + v3 - (v4 + v5 + v6);
end;

Function GetCircumCenter(Triangle : Array of TPoint) : TPoint;
var
a : Integer;
b : TPoint;
Mat : Array of Array of Integer;
begin
SetLength(Mat, 3);
For a := 0 to 2 do
SetLength(Mat[a], 3);
Mat[0] := [Triangle[0].x,Triangle[0].y,1];
Mat[1] := [Triangle[1].x,Triangle[1].y,1];
Mat[2] := [Triangle[2].x,Triangle[2].y,1];
a := Det3X3(Mat);
Mat[0][0] := Round(sqr(Triangle[0].x) + sqr(Triangle[0].y));
Mat[1][0] := Round(sqr(Triangle[1].x) + sqr(Triangle[1].y));
Mat[2][0] := Round(sqr(Triangle[2].x) + sqr(Triangle[2].y));
Mat[0][1] := Triangle[0].y;
Mat[1][1] := Triangle[1].y;
Mat[2][1] := Triangle[2].y;
b.x := - Det3X3(Mat);
Mat[0][1] := Triangle[0].x;
Mat[1][1] := Triangle[1].x;
Mat[2][1] := Triangle[2].x;
b.y := Det3X3(Mat);
result.x := - Round(b.x / (2*a));
result.y := - Round(b.y / (2*a));
end;

Procedure ClockTriangle(var Triangle : Array of TPoint);
var
Mat : Array of Array of Integer;
a : integer;
P : TPoint;
begin
SetLength(Mat, 3);
For a := 0 to 2 do
SetLength(Mat[a], 3);
p := GetCircumCenter(Triangle);
Mat[0] := [Triangle[0].x - P.x, Triangle[0].y - P.y, (Triangle[0].x - P.x)*(Triangle[0].x - P.x) + (Triangle[0].y - P.y)*(Triangle[0].y - P.y)];
Mat[1] := [Triangle[1].x - P.x, Triangle[1].y - P.y, (Triangle[1].x - P.x)*(Triangle[1].x - P.x) + (Triangle[1].y - P.y)*(Triangle[1].y - P.y)];
Mat[2] := [Triangle[2].x - P.x, Triangle[2].y - P.y, (Triangle[2].x - P.x)*(Triangle[2].x - P.x) + (Triangle[2].y - P.y)*(Triangle[2].y - P.y)];
if (Det3X3(Mat) <= 0) then
begin
P := Triangle[0];
Triangle[0] := Triangle[2];
Triangle[2] := P;
end;
end;

The det3x3 is just the determinant of a 3 x 3 matrix :), if it does the opposite of what it is supposed to be doing, change Det3X3(Mat) > 0 to Det3X3(Mat) =< 0, the rest of it should be alright, but can't be arsed to check it out:P Btw, it crashed on me aswell, i think it is the form part though oh and for my stuff to work you'd need to work with triangles(go figure) but that'd be something you want to do anyways, if you want detail, btw, try to make the rendering in a plugin, it will GREATLY enhance the speed, believe me lol

Gu3st...

2008-05-15 13:28:10

wow great! what about making ur space ship to shoot? :D

almost

2008-05-15 17:10:45

It would be easy to make the meteors 3D too, but the more things i put on there the more "flashy" it gets and looks really bad.
SCAR is pretty limited with this kind of thing.

try to make the rendering in a plugin, it will GREATLY enhance the speed, believe me lol


So i guess i should do that but i'm not sure how.
Anyone know a tut or want to teach me?

you should make it more visible when you get hit

Well it should make a noise when you get hit.
Also when you fire and get powerups.
Is that part working for everyone?

P1nky

2008-05-15 22:20:57

wow neat great job dude

Naum

2008-05-16 12:13:48

This amazes me really Good Job.
Would be really cool if you had that Cube and used it as a gun and shot people ;).
But Loving This soo much!

Dan Cardin

2008-05-16 14:28:03

itd be cool if you made it like that star wars game StarWars Arcade

google

Freddy1990

2008-05-16 19:28:21

Wow great job, if you want I can put it in with SCAR, but you'd have to fix the bug with the retry button first though

almost

2008-05-16 21:28:34

Wow great job, if you want I can put it in with SCAR, but you'd have to fix the bug with the retry button first though

I would feel HONORED.
But the thing is i don't get the bug, so if i could get details on what to do or just what it is i know i can fix it.

Also if you had to change the draw speed please tell me.
I wasn't sure if it would change from computer to computer so i put it as a const.

Zezi

2008-05-17 07:03:33

Crashed scar
When you die, the retry button flickers, a lot. And rashes

almost

2008-05-17 11:22:19

I tested out every scenario i could think of and can't get SCAR to crash, but i might have figured out what happens so i posted a new version.
I think putting TTimer.Interval:= -1 makes it crash, so i replaced it with TTimer.Enabled:= false;
Anyways if you still get the bug in the new version here is the part of the code that it does when you die-
if HealthR.Width > 149 then //if your health bar is all red then...
begin
//set all timers off
Timer.Enabled:= false;
OrbTimer.Enabled:= false;
PowerTimer.Enabled:= false;
ClearScreen; //clear out the screen
//reset bars
HealthR.Width:= 0;
Orbs2.Width:= 0;
PowerC.Width:= 0;
//Turn off your powers
Blast:= false;
Reflect:= false;
Dead:= true;
//Reset the meteor positions
for a:= 0 to Meteors do
begin
Meteor[a].Pos.x:= cx + 2;
Meteor[a].Pos.y:= cy + 2;
end;
x:= 0;
y:= 0;
//Show the game over form
SafeInitForm2;
SafeShowFormModal2;
FreeForm(SetUp);
//turn timers back on
Timer.Enabled:= true;
OrbTimer.Enabled:= true;
PowerTimer.Enabled:= true;
Exit;
end;

Smartzkid

2008-05-18 00:17:34

Amazing, one of the best games I've ever seen in SCAR. (3d > 2d anyday :))

almost

2008-05-18 11:15:10

Thanks smartz :)
So did you get the bug on the new version?

lordsaturn

2008-05-18 12:17:33

Lol you can go outside the map

Smartzkid

2008-05-27 19:42:26

From: almost
Thanks smartz :)
So did you get the bug on the new version?


Nope. FYI, global angle and scaling tools would be pretty nice :)

&if you want a real challenge, load objects from .obj files.

sink998

2008-10-11 13:26:50

amazing just took me like an hour before i realized how to close it LOL

sink998

2008-10-11 13:29:24

he he theirs a hidden mode light speed mode hold down space bar hehe

Freddy1990

2008-10-17 13:22:21

Looks ready for SCAR?