Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 ViewsMy project contains a square that moves via keyboard controls. But I'm just using the Keydown event for each individual key. How should I make the movement more smooth.
Project for testing: http://www.newgrounds.com/dump/item/24ca50b96837bac5d3dc9cc8758785af
Code:
import flash.display.Sprite;
import flash.events.Event;
stop();
var rectangle001:Sprite = new Sprite;
var speed:Number = 1;
rectangle001.graphics.lineStyle(5, 0x0000FF );
rectangle001.graphics.beginFill(0x85FF12);
rectangle001.graphics.drawRect(50, 50, 50, 50);
addChild(rectangle001);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler001);
function keyDownHandler001 (event:KeyboardEvent){
if (event.keyCode == Keyboard.LEFT && rectangle001.x >= -45){
rectangle001.x -= speed;
trace(rectangle001.x + " " + rectangle001.y);
}
else if (event.keyCode == Keyboard.RIGHT && rectangle001.x <= 855){
rectangle001.x += speed;
trace(rectangle001.x + " " + rectangle001.y);
}
else if (event.keyCode == Keyboard.DOWN && rectangle001.y <= 435){
rectangle001.y += speed;
trace(rectangle001.x + " " + rectangle001.y);
}
else if (event.keyCode == Keyboard.UP && rectangle001.y >= -45){
rectangle001.y -= speed;
trace(rectangle001.x + " " + rectangle001.y);
}
}
Is it worth me becoming more serious about AS3 as a language? Or should I just drop it and learn C# or C++ or some crap instead?
What are it's pros and cons over other languages, etc?
Graphic Interchangeable Format, not 'Jraphic'. So gif with a hard 'G'.
I blame NewgroundsMike for making shitty back-and-forths.
I lose stuff all the time. ALL THE TIME. And today I've lost the stylus to my wacom tablet; and I've went through my entire room. So, the question arises, what should I do to help myself remember things?
Go to top right where it says 'classic', select reset workspace and it should resize all the panels.
I added the enter frame to try and fix a bug earlier; but since, I forgot to remove it. Thanks for the help Sam, my little .swf is running perfectly now. Thanks again!
At 10/23/14 02:22 PM, Sam wrote:At 10/23/14 01:48 PM, GrahamNG wrote: So I'm making a test in whicha square moves. Except when I do 'blah.x += 1' or something similar it won't move it by one pixel, something more like 20. Why is this? Why isn't it done by pixels?It is done by pixels, you may be applying +1 multiple times per frame or the movement happens in consecutive frames so it looks like it's moving more.
Thanks. Though is there anyway I could make it look smoother. Test it out here (keyboard directions): http://www.newgrounds.com/dump/item/bdedb36e714b0eae6518377c5c3fcb9b
So I'm making a test in whicha square moves. Except when I do 'blah.x += 1' or something similar it won't move it by one pixel, something more like 20. Why is this? Why isn't it done by pixels?
At 2/8/13 10:02 AM, Pkmn2 wrote: Something called "Kinder Pingui"
I fokn love kinder chocolate. Yet I haven't seen one of these yet :(
I was setting up a little square that moves when the correlating key is pressed. But, without returning any errors, when I click the button the square won't move.
My code:
import flash.display.Sprite;
import flash.events.Event;
stop();
var rectangle001:Sprite = new Sprite;
rectangle001.graphics.lineStyle(5, 0x0000FF );
rectangle001.graphics.beginFill(0x85FF12);
rectangle001.graphics.drawRect(50, 50, 150, 150);
addChild(rectangle001);
addEventListener(Event.ENTER_FRAME, enterFrameHandler001);
function enterFrameHandler001 (event:Event){
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler001);
function keyDownHandler001 (event:KeyboardEvent){
if (event.keyCode == Keyboard.LEFT){
rectangle001.x += 10;
}
}
}
So where am I going wrong? Thanks for all the answers in advance.
Whenever I split or shorten a clip the 'ghost' of a clip remains, which means nothing visually on the comp but it's still annoying. What is it and how do I remove it?
You're not removing the event when you move to a new frame. Just do removeEventListener in the event which changes frames.
https://www.youtube.com/watch?v=rUgf53xhd6I&list=UUFPawGlt7H3IQLT2pJQEjlQ
Well, I've applied.
I fixed it. My code was fine. But I had to change Shape to Sprite, but I have no idea why...
At 10/18/14 08:49 PM, MSGhero wrote:At 10/18/14 08:43 PM, GrahamNG wrote: Where am I going wrong?Did you ever addChild the shape?
Yes, but me being a retard, I forgot to paste it.
So I'm trying to get into creating without drawing directly onto the stage.
My Code:
import flash.display.Shape;
import flash.events.MouseEvent;
stop();
var rectangle001:Shape = new Shape;
rectangle001.graphics.beginFill(0x00D783);
rectangle001.graphics.drawRect(10, 10, 50, 50);
rectangle001.addEventListener(MouseEvent.CLICK, rectangle001Click);
function rectangle001Click (event:MouseEvent){
trace("Hello World!");
}
Where am I going wrong?
I just got this message:
Hello dear,
My name is Cynthia and i saw your profile
and i became interested to make friend with you.Some friends are remembered
because of their smile. Some friends are remembered because of their style.
But you are remembered because you are so nice to remember. pls i will like to
know more about you. if you can contact me through my email address here(cynthia.achizizy@hotmail.com) I really
look forward to reading from you soon.
Thanks.
Yours Truly Friends.
Miss Cynthia
Wat. Is this genuine, because it looks like a bot.
Hello. I've got a better idea. Have the object added to the stage as a child and have a mouse click event remove it and replace it with the other lightbulb. Much more efficient.
At 9/28/14 09:43 PM, AssassinOrd3r wrote: Our team is currently in development of a unique MMORPG and seeking an experienced AS3 programmer to come onboard as a volunteer until the game starts earning significant profits. If you have experience programming MMO games in Flash and/or Unity, please contact us and provide links to any relevant projects.
So you want someone to sink significant hours into work they're not going to get anything from. WAT. Plus MMO's are some of the most time-consuming games to make.
http://code.tutsplus.com/series/as3-101--active-7395
Read through this and get an IDE.
Start Programming.
???
Profit.
1. I'm pretty sure it supports other formats.
2. In certain aspects certainly.
3. No, it's not prominent in all fields as it used to be, but it's still useful.
At 10/11/14 01:29 PM, Sam wrote:At 10/11/14 12:58 PM, GrahamNG wrote: when coding, what does 'new' mean and what's it's functionality.Constructs an object of that type:
var myCar:Car;
// type may be 'Car' but it has no value to it (null)
myCar = new Car();
// instantiated a new 'Car' object, constructor is called at this stage
Ah. I think I understand. So specifies further than just var myCar = car. You can have multiple cars that you own?
when coding, what does 'new' mean and what's it's functionality.
I just installed Adobe Flash Professional CC. None of the removed features were anything I cared about and I liked the new design and html5 support.
Then I realised bandwidth profiler was also removed. Feck.
Is there any plug-ins for cc that are essentially bandwidth profiler?
Right, so I want something to happens when two conditions are met.
Something like:
if (11 + 4 == 15 also 13 + 6 == 19){
somethingHappens
}
This thread is frickin' huge.