Welcome to the Easy and Basic 3D tutorial.This somewhat 3d type game still has me pondering because I know it isn't completed with boundaries or anything yet.Let's begin.
What is used in this tutorial
_xscale
_yscale
Key.isDown
Keycode
Flash Camera(find it on Newgrounds)
Variables
Coded Boundary
You need to draw out your background place.This is pretty much the part that makes this 3d.
Orange and Black Game Collab Engine(currently in edit)
This engine is still being bugged out as you may see.
Movement Keys
w-forward
s-backward
a-left
d-right
Make sure your background looks somehwhat similar to that using point perspective.
The coding part requires you to have a Flash camera.The code will be placed inside the camera.You can find it somewhere off Newgrounds I'm guessing.(Flash Camera requires Flash 7)
First of all,add your variables.I mean variable.The rest of the variable use areas need to be changed individually.
onClipEvent (load) {
speed = 3;
}
Pretty simple,eh?Ok,next,add your first bit of real code.
onClipEvent (enterFrame) {
if (Key.isDown(83)) {
this._xscale += 2;
this._yscale += 2;
}
onClipEvent-Sets the event to happen,in this case,enterFrame
if-The 'if' of the code to set what happens(when there's an 'if',then there is a 'then')
Key.isDown-Setting the type of 'if'
(83))-Usually there would be something like (Key.UP)) here.I decided since the mouse and keyboard is used in my game that I would use Letter Keys.83 in keycodes is S.I'll list the keycodes later in the tutorial,or you can find them in the main tutorial section.
this.-This lets Flash know that we're talking about 'this' MovieClip,the Camera.
_xscale-Similar to _width.If you move all the way forward in my game,you'll end up flipping everything.It's wierd.
_yscale-Similar to _height.This helps in the move all the way forward
_x-stands for left/right in movement,or in this case,for width/_xscale.
_y-stands for up/down in movement,or in this case,for height/_yscale.
+=2;-adds how much width/height to the MovieClip as selected.
-=2;-subtracts how much width/height to the MovieClip as selected.
This goes for the next part of the code...
if (Key.isDown(87)) {
this._xscale -= 2;
this._yscale -= 2;
}
Notice how the 'if' is continued.Keep it that way.87 stands for W.
This next code is to move your Camera left or right.
if (Key.isDown(6) {
this._x += speed;
}
68 stands for D.
...and...
if (Key.isDown(65)) {
this._x -= speed;
}
65 stands for A.
Now I'll get into some boundaries.
if (this._x>550) {
this._x = 550;
}
This code is a basic AS boundary.
_x>550-and easier way to understand this is saying "If this object's _x is 550..."
_x=550-this continues the last sentence "...then the object's _x should be 550(still)"
Here are the AS Keycodes that I promised...
65=A
66=B
67=C
68=D
69=E
70=F
71=G
72=H
73=I
74=J
75=K
76=L
77=M
78=N
79=O
80=P
81=Q
82=R
83=S
84=T
85=U
86=V
87=W
88=X
89=Y
90=Z
These boundary codes keep your Camera from exiting the area left from right or up from down.The problem is that I haven't gotten one of my boundary codes for the _y value to work yet.Also,I still have to edit my camera to get my aimer to keep it's size.So...that's it for basic 3D moving.
BASICBASICBASICBASICBASIC Even more basic then delta_luca's I bet.