Under rating threshold (hideshow)
The link to ths ship image: http://chat.kongregate.com/gamez/0002/4537/live/assets/ship.png
(it's provided in the tutorial, but as someone was asking...)
Under rating threshold (hideshow)
A hint to everyone whose having difficulty, always SAVE BEFORE TESTING. The testing will not work unless the code has been recently saved.
Under rating threshold (hideshow)
It does work on cs5.5, I just did it after literally a good 40 minutes of not understanding why it didn't work. I just tried it for the 3rd time and I had done everything right according to the tutorial before. So yes it does work for cs5.5.
Under rating threshold (hideshow)
i cant download the ship that they are using anyone have the link?i draw my own but i dont know the tools to use to actually select it if that makes sense...
Under rating threshold (hideshow)
My movieclip ship also doesnt have a blue box, is that because it doesnt work or because its CS5, i would really love if they made an updated version for CS5 and actionscript 3, because learning actionscript 2 seems redundant, because its outdated
Under rating threshold (hideshow)
Does this not work in CS5, because my code is identical to this one, but the interface in CS5 is different so im not always sure if im doing things correctly, but when i try to run it it just sits there but there are no errors or warnings
Under rating threshold (hideshow)
So what is wrong with my code?... Whenever I start the game, my ship automatically starts moving.
class Ship1 extends MovieClip
{
var velocity;
function onLoad()
{
velocity = 10;
}
function onEnterFrame()
{
if (Key.isDown(Key.RIGHT))
{
_x = _x+velocity;
}
if (Key.isDown(Key.LEFT))
{
_x = _x-velocity;
}
if (Key.isDown(Key.UP))
{
_y = _y-velocity;
}
if (Key.isDown(Key.DOWN))
{
_y = _y+velocity;
}
_x = _x+velocity;
}
}
Under rating threshold (hideshow)
I managed to get to page 10. My ship moved from left to right on page 9, but when I change onenterframe function it won't budge.
Under rating threshold (hideshow)
my ship wont move... this is my code
class ship extends MovieClip
{
var velocity;
function onLoad()
{
velocity = 10;
}
function onEnterFrame()
{
_x = _x + velocity;
}
}
i don't know what is wrong with it... HELP!!!
also my file names ship are the same
Under rating threshold (hideshow)
Be sure to check in the class. Make sure your "class Ship extends movie clip" and Ship save files are the same case. Having them in different cases will cause the ship not to move when the clip is tested.
Under rating threshold (hideshow)
People, just don't forget, the ship is being accelerated while u press a key, so 2 keys (up and left) will mean your ship flies two times faster than just straight.
Under rating threshold (hideshow)
For AS 3.0:
Step 9
Create a Movieclip and add following code into the first frame of the "Ship Clip":
var velocity;
velocity = 10;
addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler_3);
function fl_EnterFrameHandler_3(event:Event):void
{
x = x + velocity;
}
Under rating threshold (hideshow)
If you guys want to use the WASD keys instead of the arrow keys, it's quite simple. You just need to input the keycode in the parentheses. For example if I wanted to use the W key to make the ship go up, I would use this code instead, "function onEnterFrame()
{
if( Key.isDown(87) )
{
_x = _x + velocity;
}
}
I haven't tried it yet, but it might be "key.87" instead of just 87. It's actually a lot different in AS3. If you want the other keycodes, this website has a list of them. http://www.aspdotnetfaq.com/Faq/What-is-the-list-of-KeyCodes-for-JavaScript-KeyDown-KeyPress-and-KeyUp-events.aspx
Under rating threshold (hideshow)
I DONT GET IT i tried to make the ship thing move but it wont let me it stays the same and it says error message Symbol=Symbol 1, layer=Layer 1, frame=1, Line 1 The class or interface 'Ship' could not be loaded.
Under rating threshold (hideshow)
Very if if you put the code right. the actionscript file and the movie file must have the same name: e.g. ship.as and ship.fla
Under rating threshold (hideshow)
Geez.... After a least an hour of trying to figure out step 9 and it worked a literally gasped and then jumped for joy!
Under rating threshold (hideshow)
I forgot to add ActionScript linkage. XD
The problem persisted after I finally added linkage, but then it continued. It worked when I deleted the instance of the Ship and re-added it. Hope this helps! ;)
Under rating threshold (hideshow)
IF YOU ARE HAVING PROBLEMS:
Keep trying.
That feeling I got when I conquered the problem made it all worth while. And it will for you too. ;)
Under rating threshold (hideshow)
felix2020 what i did for step ten was SAVE!!!!! and it moved on command (stupid me)... so u can click on the place where they put codes and it copys them so u can put it in urs.. hope this helps
Under rating threshold (hideshow)
wait, sorry. I just fixed step 9, but for step 10 i enter the code and test the movie, the ship keeps moving right instead of being controlled by my right arrow key. Anyone know what i did wrong?
Under rating threshold (hideshow)
Im stuck on step 9, just as many other people are/were. I followed all the instructions very carefully, and even redid the whole thing twice but it still doesn't move.. i've made sure the caps, and spacing is correct, and that im using AS2 instead of AS3. Can anyone help please?? pm if you can
Under rating threshold (hideshow)
great tutorials. unfortunately waaaay to many people have been abusing this amazing gift by copying exactly the same images and everything. atleast draw your own. or if your to lazy to do that atleast dont upload it to kongregate.
Under rating threshold (hideshow)
if you want to keep your ship from flying off-screen, after the "(Key.[direction you use])" type
"&& _x < ###" being ### whatever value you want, and "<" is for right and down only, use ">" for up and left
here's an example if( Key.isDown( Key.RIGHT) && _x < 200) {_x += velocity;}
this is so when the ship gets to x=200 it will stop moving right
hope it helps.