Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsI think if you just do:
var color:ColorTransform = targetObj.transform.colorTransform;
color.redMultiplier = 1;
color.blueMultiplier = 1;
color.greenMultiplier = 1:
targetObj.transform.colorTransform = color;
or even just
targetObj.transform.colorTransform = new ColorTransform();
it will undo the effect
So from what I can tell, the problem you are facing is that when the box moves, the collision detection is not updated.
Correct?
The problem is that your collision-detection function only uses the anchor variables (c1,c2,c3,c4)
which don't get changed after the initial function.
Instead of:
_object.x += 1;
you need something like:
_object.x += 1;
c3.x = _object.x - _object.width / 2;
c3.y = _object.y - _object.height / 2;
c4.x = _object.x + _object.width / 2;
c4.y = _object.y + _object.height / 2;
It would also be better if you moved that chunk of code to the beginning of the function, otherwise the rectangle gets moved after it's bounding box is drawn and they wont be exactly on top of each other.
Other improvements you could make are:
- Replacing the anchors with Point objects since you are only using their x & y properties (you also need to remove the corresponding addChild() calls, otherwise you will get errors)
- Remove c3 & c4 entirely since their values can always be derived from "_objects" position.
- Give the variables and parameters meaningful names. (Ex: r1 -> line1Start, box1 -> boxTopLeft)
- add some comments in the rayRayIntersect function that explain the math behind what is being done
Still looking for someone.
(Btw I am open to changing the game a bit so that there is less artwork to do,)
Hi
A few weeks ago I made a post looking for a writer (http://www.newgrounds.com/bbs/topic/1352334), and now I am looking for a pixel artist.
Please take a look at the other thread for a some general info, but to recap, the game is:
- Programmed in As3
- Primarily using 32x32 bitmaps
- 2+ hours long (longer than 2 if it doesn't take too much effort or require meaningless filler content)
- Tells some sort of epic story
In general, I am picturing the game to be very similar to a RPGMaker game, the main difference being that instead of a menu-based combat there will be a grid based mini-game.
The project is still in the early stages, here's what I got so far: http://www.newgrounds.com/dump/item/c67b7c7fa030d11a5857937471ddca16 (WASD + ENTER)
(I'm using a bunch of graphics I found on the web, they are just placeholders and will be removed later)
What I need the artist for:
- Sprite sheets for character movement (32x32 images)
- Tilemaps for backgrounds (I am planning to mostly use some free set from the internet, but it would be good to have someone that can create extra tiles as needed)
- Sprite sheets for spell casting in combat-minigame
- Portraits for players or NPCs (something around the 140x140 size)
- Some relatively detailed drawings of main characters (shown at key moments so player knows how characters look in the game world)
- Various Interface items & menus
- Misc graphics
It would also be a bonus if you could create a few large pictures (approx 640x540) of key moments in the story, but I might get a separate person for those.
I would like almost all of the art to be in an "anime" kind of style, so that is a semi requirment.
What you get from this:
- Experience
- Something to add to the ol portfolio
- A large slice of the generated revenue if any money is made (I wouldn't count on this though)
Send me a PM or leave a message below if your interested!
Found someone.
Hi,
I'm planning to create a JRPG style game (similar to RPGMaker games) with some sort of epic story.
I have some ideas for what I would like the story to be like but nothing too specific.
So far I'm picturing the game:
- Programmed in AS3
- About 2 hours long
- Set in medieval magical setting (original I know : P)
- Targeted at an older audience (16+ or something like that)
- Maybe themed about something like conflicting ideologies, surjective morality, or situations with no "right answer" (but done in a subtle way, this isn't meant as a platform for me to force my opinions on others)
I'd like to team up with someone who has some experience writing stories to discuss ideas with.
To start out I would like to be heavily involved in the story planning, but once the general direction has been set I'd leave you to sort out the finer details.
My primary role in the project would be Programming, general game designer, and team coordinator (once we get an Artist and musician aboard, but that won't be for a while).
Your jobs would include:
- General Story planning
- More specific story planning
- Character design
- Writing character dialogue (once the game has reached a playable state)
Send me a PM or a leave a message below if you're interested!
(links to previous works would also be nice)
You can ask me questions if you want.
PM me over newgrounds or send me a message on Skype (username: theCodeCat)
At 9/22/13 03:57 PM, motokocat22 wrote: on(release){
if (root1=0) {
_root.gotoAndPlay("charmbooster");
} else {
if (root1=1) {
_root.gotoAndPlay("gone");
}
}
flash gave me a syntax error. what did I do wrong?
I'm not sure if this is actually a syntax error, but you probably meant to write:if(root1 == 0), not if(root1 = 0)
= is for assignment, == is for checking equality
The problem isn't with the hittest, you are simply trying to check for a collision with a non existant object.
Why are you trying to perform a hittest at that point in time? Should the enemy always exist at that point?
If it is simply a case of not knowing how to "turn off" the hittest, you can do something like:
//Checks if object exists
if( objectImHittestingAgainst != null ){
//--Put hittest code here--
}
First off, your post has been up for like an hour, it is way too early to get mad at people for not responding.
Formatted Version of code:
package
{
import as3isolib.display.IsoSprite;
import as3isolib.display.IsoView;
import as3isolib.display.scene.IsoGrid;
import as3isolib.display.scene.IsoScene;
import as3isolib.geom.Pt;
import flash.display.Sprite;
[SWF(width="800", height="600", backgroundColor="#000000", frameRate="30")]
public class game extends Sprite
{
private static const CELL_SIZE:Number= 50;
private var grid:IsoGrid;
private var scene:IsoScene;
private var view:IsoView;
public function game()
{
grid = new IsoGrid();
grid.setGridSize(8,8,1);
grid.showOrigin = false;
grid.cellSize = CELL_SIZE;
scene = new IsoScene();
scene.addChild(grid);
var myMap:Array = [
[1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,0,],
[1,0,0,0,0,0,0,0,],
[1,0,0,0,0,0,0,0,],
[1,0,0,0,0,0,1,1,],
[1,0,0,0,0,0,1,0,],
[1,0,0,1,0,0,1,0,],
[1,0,0,1,1,1,1,0,],
[1,0,0,0,0,0,0,0,],
[1,1,1,1,1,1,1,1,]
];
var iso:IsoSprite
for(var i:int=0; i<8; i++)
{
for(var j:int=0; j<8; j++)
{
iso = new IsoSprite();
iso.moveBy(j*50, i*50, 0);
iso.sprites[brick,grass];
}
}
scene.render();
view = new IsoView();
view.setSize(800,600);
view.centerOnPt(new Pt(200,200,0));
view.addScene(myMap[j][i]);
addChild(view);
}
}
}
I don't actually know the as3isolib, so I can't give you detailed advice, however it looks like you declare your myMap array and never really use it.
The only point you reference it is:
view.addScene(myMap[j][i]);
which is weird since you are re-using the integers from the loops.
From the way your loop is set up, 'i' & 'j' should both be 8 at that point, so you are trying to access myMap[8][8] and add it as a scene.
I imagine that the array is meant to be accessed somewhere in double-loop
Maybe take a look at that.
So you want the players downward acceleration to be reduced so long as they are still holding the jump key, right?
It looks like you have pretty much the right idea but this top part here:
vy += jumpForce;
holdJump = true;
onGround = false;
if(holdJump == true && onGround == false)
{
gravity = 1;
}
else
{
gravity = 2;
holdJump = false;
}
Seems a bit confused, since you are checking the values of holdJump & onGround directly after setting them
Also, this bottom part:
if (holdJump == false)
{
....
is only checking if the holdJump state and will be triggered even when the player is just walking
Apart from that, you are also setting the gravity to 3 different values in different places, so I don't know what that is about.
Here's how I would change your code:
if (event.keyCode == Keyboard.X && onGround == true)
{
//Perform jump action
vy += jumpForce;
//Character is no longer on the ground
onGround = false;
//Jump is currently held down
holdJump = true;
//Set to altered gravity (since the jump key is down)
gravity = LOWER_VALUE;
}
//...
if (event.keyCode == Keyboard.X)
{
//Checks if player is within the air and has been holding the jump key since the beginning
if(onGround == false && holdJump == true){
//Player is no longer holding jump
holdJump = false;
//Returns gravity to normal
gravity = NORMAL_VALUE;
}
}
You also need to make sure to account for cases where the player holds the jump key for the entire jump. So be sure to correct the gravity when the player lands.
If you wanted to make your code a tiny bit shorter you can also change stuff like:
if( foo == true ){...
to
if( foo ){...
and
if( foo == false){...
to
if ( !foo ){...
('foo' and 'foo == true/false' are both boolean values, so you can just use the 'foo' value directly)
Oops, the one line should say:
if (remainingpoints > 0) {
not
if (remainingpoints < 0) {
Use code tags to preserve formatting next time.
Your logic is faulty. You are always checking whether the remaining points are below 27 (or <= in some cases), why?
Just think through the problem.
Case (1) A player wants to upgrade a stat: If the player has upgrade points, upgrade the stat. (if remainingPoints > 0)
Case (2) A player wants to downgrade some stat, if it is possible to downgrade the stat further, downgrade the stat. (if statValue > 0)
Because you have repeated chunks of code I'm just going to show you how to fix one upgrade-downgrade pair:
//Before
on(release){
if (remainingpoints<27) {
strength -= 1;
remainingpoints += 1;
} else {
this.enabled = false;
}
}
on(release){
if (remainingpoints<=27) {
strength += 1;
remainingpoints -= 1;
} else {
this.enabled = false;
}
}
//After
/* If there are points in strength, downgrade it. */
on(release){
if (strength > 0) {
strength -= 1;
remainingpoints += 1;
}
}
/* If the player still has upgrade points, upgrade strength. */
on(release){
if (remainingpoints < 0) {
strength += 1;
remainingpoints -= 1;
}
}
The others seem to have explained most of the more technical stuff already so I would just like to add that OOP is really just an approach to organizing your code. Stuff like private/public or setters and getters are just there to make it easier.
If you are just starting out, then I would recommend that you start by focusing on breaking your projects into meaningful objects. Once you've got the hand on that, start using private/public modifiers and try to have as many object properties marked as private, and only then start worrying about getters and setters.
You should provide some more details.
All you are saying right now is that you want someone who can program to do something for you involving some game.
What do you want done?
Would they get paid or compensated in some other way?
What kind of game is it?
What is your role in all this?
At 7/26/13 09:19 AM, DJauditor wrote: When I want to open Ican see the welcome screen but when I can read initializing fonts than flash will not open pls help!
You would be better off looking for help on official adobe support pages for flash pro, seeing as you are experiencing software problems, not programming problems.
A lot of the users here don't use Flash Pro and, of the ones that do, they probably don't have the new CS6.
1. Make a button with an X graphic
2. Make code execute when it is pressed
3. Make that code make the window in question invisible or something
This is pretty basic stuff, can you specify which parts are confusing you?
You could put everything into a movieclip, call it "fakeStage", and then just move that around.
It would have the same visual effect.
(if a graphic is the child of another graphic, moving the parent graphic moves also moves its child)
At 7/18/13 10:23 PM, UltimatumVox wrote:At 7/18/13 10:18 PM, nitokov wrote:Dang...At 7/18/13 09:53 PM, UltimatumVox wrote: How do I move the stage in AS2.You don't, you move stuff inside it. And may I ask why AS2?
Y'know, that square thing that's like the view port of the swf?
Well, I thought AS2 would be easier than AS3, then I would go learn AS3 once I got used to AS2.
nito, if I moved the level around the character, but moved the character also, wouldn't both get out of view?
I just realized that
return false;
trace("===End of hitTest===");
is kind of stupid, but you get the general idea.
I can't see the problem just from looking at, but the error is saying something about a parameter being null in your hitTest function, so I would suggest you add some trace commands in there like so:
function hitTest():Boolean{
trace("===Starting hitTest===");
trace("Player: ",player);
for(var i:uint=1;i<=5;i++){
trace("Object " + i + ": ",getChildByName("platform"+i));
if(player.hitTestObject(getChildByName("platform"+i))){
return true;
}
}
return false;
trace("===End of hitTest===");
}
Then run the code until the error pops up and check which, if any, one of those object was null.
(if an object is null the trace for it will be "null")
(also use code tags when posting code so that the indentation is preserved)
At 7/16/13 04:07 PM, frazer151 wrote: So I can code pretty well on the timeline and within movieclips. But I've come to understand this is not the best way to code at all. (if you can call it coding right?) ... well, so I started learning how to use classes.
I made this:
package game {
import flash.display.Sprite;
public class World extends Sprite {
public var population = 1000;
public function PopulationGrow (){
var i = "hello"
trace(i);
}
trace("Hello2");
}
}
However, for some reason, only "Hello2" is traced. I came to understand that functions activate automaticly from the main class? Well, how am I supposed to activate the function?
Each class has a constructor function that gets called when the object is created.
The constructor function always has the same name as the class, so in your case it would be:
public function World(){
trace("World object created");
}
If you don't add an constructor to your class then a default constructor gets used which doesn't do much.
Like I said, the constructor gets called when the object is created, which is normally when you use the "new" keyword.
Ex:
var aWorld:World; //This line does cause output
aWorld = new World(); //Outputs: "World object created"
However, a document class is a little different in that it gets created automatically when the game loads, without you having to code anything.
The code you are looking for is something like this:
package game {
import flash.display.Sprite;
public class World extends Sprite {
public var population = 1000;
public function World(){
trace("Hello2");
PopulationGrow();
}
public function PopulationGrow (){
var i = "hello";
trace(i);
}
}
}
(also, it is good to always declare your variable types like: var i:String = "hello"; instead of var i = "hello";, and, although this isn't that important, don't use the variable name "i" from strings. The name "i" is almost always used for integer types, using it as a string will confuse other people reading your code)
I think you need to scale down your project a bit if you want to get more people interested.
Instead of making some crazy awesome 3D rpg, do the project in a 2D JRPG style with a focus on story rather than cool visuals.
Getting any project done makes it more likely that people will want to collab with you, since no one wants to put lots of effort into something that later gets abandoned, so if you make a good small-scale rpg, you will be in a better position to create something more complex in the future.
For my current platforming game I made an external flash program that lets me place objects in levels and saves it as a custom level-data file, mostly made up of As3 code. Then I have another small java program (if you know it, use Python for stuff like that) which grabs the As3 code from the level files and basically copy-pastes them into a bunch of .txt files. These .txt files then get included in the project when it gets compiled and gets treated like code.
(I have this level-data -> .txt files -> game setup as opposed to level-data -> game because it makes it harder to screw up your project files)
I'm not sure I would recommend that approach though. It worked for me but isn't all that elegant.
My main piece of advice for you would be just to keep the level-editing process in mind when designing a game, don't add it as an afterthought. Players want a game to be full of good content, and good content is hard to come by when adding it your game is awkward.
That fixed it. Thanks for the quick response.
I've noticed that when you are pressing a key while playing the game, then click outside the game and release the key, the game won't catch the key-release event and keep responding as if the key was pressed.
Is there anything I can do to prevent this from happening (like catch an event when the game loses focus or periodically perform some sort of key-press check that does not rely on events)?
At 6/27/13 05:52 PM, NecroBlight wrote: Is it possible to use a var as a reference and not as storage, for example if I assign var 2 to var 1 and then change var 2, so when I call for var 1 it'll read the new var 2 and not the old var 2.
Have you ever programmed something in C?
In C you can have pointer variables that contain the memory addresses of other variables and then have the option to edit either the variable's data (a memory address) OR the data the memory address is pointing to.
Ex:
int var1 = 4;
int* var2 = &var1;
//var1 == 4
*var2 = 2;
//Now var1 == 2
I don't think there something like that in AS3.
In AS3 variables can basically either hold a value or contain a reference to an object.
Any primitive type is stored as a value and the rest are objects.
When you assign the value of one variable to another then if it is a primitive type the value is copied but if it is an object type then the new variable simply gets a reference to the object. The object does not get copied.
Ex:
var val1:int = 4; //Primitive value
var val2:int'
val2 = val1; //4 gets copied and assigned to val2
val2 = 2; // Now val2 == 2 & val1 ==4
val anObject1:MyObject;
val anObject2:MyObject;
anObject1 = new MyObject(); //The 'new' keyword causes a new object to be created and reference is given to anObject1
anObject2 = anObject1; //Reference is assigned to anObject2, there is still only one such object in memory
anObject2.doSomething();
trace(anObject1.hasSomethingBeenDone()); //Returns true because both variables are looking at the same object
//Also note that an object does not have a special link towards the first variable it gets referenced by
//The variable is not the object
anObject1 = NULL;
anObject2 = NULL;
anObject1 = new MyObject(); //First reference to anObject1
anObject2 = anObject1; //Adds reference
anObject1 = NULL; //Original reference is gone, but the object it originally pointed to will remain until nothing references it anymore
To get back to your original question:
You can't have a reference to a VARIABLE but you can have another variable reference to an OBJECT that is also referenced by a the other variable and thereby get result where changing variable 1 effects variable 2.
Ex:
//Using primitives
var prim1:int = 4;
var prim2:int = prim1;
//Changing prim2 does not change prim1
//Using objects
var obj1:MyIntegerObject = new MyIntegerObject();
obj1.value = 4; //Changes an object property, not the variable
var obj2:MyIntegerObject = obj1;
obj2.value = 2;
//Now obj1.value == 2, however obj2 did not change the variable obj1, just the object it is pointing to
I wouldn't worry about that too much.
The hard part is making a game good enough that people want to steal it.
At 6/21/13 12:26 PM, ohmyjoshyouguys wrote: If a movie clip is rotated, does the blue bounding box rotate with it or does it make a new box around it?
It seems like it rotates the box, but when I'm checking collision it says that my character is touching something when it's actually just near where the corner would be of a new box.
The bounding box is never-rotated,
It is meant to be an indicator of in which zone of the screen the object lies.
Yeah, that's a common problem.
Basically there are two hitTest functions build into flash: the first checks for a collision between the bounding boxes of two object, and the second checks for a collision between a point and any part of another MovieClip.
There is no easy way to check if two irregular shapes are colliding.
I would suggest that you make all off your game objects rectangle shaped (or at least have a rectangle shaped hit-area) and do what the other guy said about checking for collisions with all the level objects separately (using a loop) as opposed to testing against one big composite level object. You can use the build-in function for rectangle-rectangle collisions or you can create your own.
Otherwise I have also seen some people use a pixel-perfect collision system that involves converting both objects into bitmaps for the collision test (http://www.mikechambers.com/blog/2009/06/24/using-bitmapdat a-hittest-for-collision-detection/). I wouldn't really recommend it because I think this method puts extra strain on your game in exchange for unnecessary accuracy and it isn't very flexible, but it should do what you want.
I'm a bit confused, could you post a screenshot of what the collision problem looks like?