180 Forum Posts by "Nisas"
To my knowledge there are a few different ways to handle collision. I'll call them the impulse method and the look-ahead method.
Impulse method operates by making objects that collide repel each other with a certain velocity or acceleration. So if an object collides with a wall the object is pushed back with X force. More useful for character vs character collision imo.
The look-ahead method checks the location it wants to move to and if there is a collision it moves back. You could also check many locations to find the best usable one. You could try checking every pixel between the start point and the end point to find the best location to move to. However, since it's essentially searching a list of pixels for the one location nearest to the wall that doesn't collide, I wonder if a binary search algorithm would work here. IE: check pixel inbetween start and end. If collides then recursively check pixels nearest the player and if not recursively check pixels nearest the wall.
The biggest most annoying stumbling block is trying to make the parts swappable while still being able to animate them. Parts of my character are all in separate movieclips which I tween around. Normally I would use graphics instead of movieclips and each part would contain all the drawings for that part. So I would have a leg graphic containing every leg drawing I could want, then I use the frame selector to change the leg to the version I want. Without this feature, the only way to set this is by using a gotoAndStop on every frame where I want to change to a different leg. I can't even preview what the animation would look like this way because the movieclips don't preview like graphics do.
I'm being driven mad by this problem. Can anyone think of a good way to make game characters where you can easily swap out certain parts in them or change their colors at run time? For example, if you wanted to make a character who could change the clothing they're wearing, the weapon they're holding, or their hair color it seems a daunting task.
The ultimate goal is to make procedurally generated characters that are all a bit different, but I can't even change the hair color without breaking tweens and making animating a huge frustration.
I'm kind of curious if the 50/50 thing is typical.
As a programmer it seems to me like programming is the real difficult part of a game project. Certainly the longest part. Of course it varies based on how complex the game is, but the point remains.
Do you also do all the game design? IE: Story, Mechanics, Enemies, and all that?
I code everything in classes except for stop(); commands.
Because like hell I'm gonna make a new class for every little animation I want to start off paused.
Your problem is the stage part
stage is undefined for an object until it is added to the stage.
You must add the object to the stage from somewhere else or pass the stage to the constructor of your object.
I'm trying to build a game with nothing in the main timeline, so everything is script driven. However, everything loads on the first frame before any code is executed.
What this means is that by the time code is executed and I generate a preloader, everything has already been loaded, making the preloader worthless.
I've heard of a fix for this before of manually making things load on the 2nd frame, but that seems kind of messy and defeats my goal of making a game with nothing on the main timeline.
Does anyone know if there's an alternate solution?
I used to use AS2 before I knew much about programming. I switched not too long after AS3 came out.
AS3 is a lot more like traditional programming languages. It's harder to learn and set up, but it is much more powerful for larger games. Especially annoying is that there is no longer a Key.isDown() function. You have to set one up yourself.
I only ever use AS2 for really small things where I only need a few lines of code.
The AS3 Main thread was very useful for me. Don't have a link to it though.
I always use AS3. It's a lot more like a traditional programming language.
VCam is a very useful tool if you know how to use it. Especially for things of this nature.
I've found that moving root (using vcam) works much faster than moving all the objects. I'm not certain why.
A mathematical version would definitely be more efficient, but you'd also lose some of the customization.
One idea I had was to create a sort of Level Creator where you use the mouse to draw a line. As you draw the line, the x and y points are recorded and can then be output later. Then by taking those points and inputting them into your original program you can get an array filled with points representing the ground.
It's quite difficult to program though.
I've seen platformers before which have curved ground.
I assume they're using a shape to create the actual structure of the ground and somehow using hitTestPoint() with the shapeFlag set to true to test collisions with the ground shape.
I can't for the life of me figure out a good way to make good motion over a curved surface though.
The only way I can imagine doing it is by calling hitTestPoint() with a point on my character and the object being the ground. If it returns true, call hitTestPoint() on a point a few pixels up and then keep calling it until I find a point where it returns false again. Then moving the character to that point.
This method seems like it would be pretty processor heavy. Especially with enemies doing it too. Is there a better way?
tl:dr - How do you make good fluid motion over a curved surface in a platformer?
Alright, that worked. Thanks man.
I've tried doing it with a pointer.
I used
typedef int* ListType;
and then
*myList[5] = 3;
but the program crashes for some reason
Woops, did the code thing wrong
I'm trying to create an abstract list class in c++. I've created a class list which uses a linked list implementation. I've overloaded the [] operator.
typedef int ListType;
ListType operator [](int index);
I am able to output the data at certain indexes using this, but I'm having trouble with assignment.
I want to be able to do something like this:
List myList(100);
myList[5] = 3; // <- this doesn't work
I can't figure out how to do it. It always returns "non-lvalue in assignment".
I'm trying to create an abstract list class in c++. I've created a class list which uses a linked list implementation. I've overloaded the [] operator.
[code]
typedef int ListType;
ListType operator [](int index);
[/code]
I am able to output the data at certain indexes using this, but I'm having trouble with assignment.
I want to be able to do something like this:
[code]
List myList(100);
myList[5] = 3; // <- this doesn't work
[/code]
I can't figure out how to do it. It always returns "non-lvalue in assignment".
At 12/22/09 03:10 PM, zuperxtreme wrote:At 12/22/09 02:50 PM, Nisas wrote: A cookie for who can identify this language (such an easy question).C/C++ ?
It was C++
congratulations, you win a cookie
1. Convert to scientology
2. Pray to Xenu
3. ...
4. Profit!
AS4
#include iostream;
#include string;
using namespace std;
void print(string message);
int main(){
cout << "Enter a message to print: ";
string message;
cin >> message;
print(message);
return 0;
}
void print(string message){
cout << "The message is: " << message << endl;
}
A cookie for who can identify this language (such an easy question).
At 12/20/09 03:49 AM, LostVoices wrote:At 12/20/09 03:11 AM, Nisas wrote: I could make a game where fetus's come back to life as zombies and kill their parents.you sir, are a complete dickhead. that was totally uncalled for!
Is that a good compromise?
The Undead Unborn !
did you just get tingles right there?
yeah, me too
The game would be a deterrent for abortions. Who's gonna abort their child when they might come back as zombies to kill them? Not me, that's for sure.
Wherever serious moral dilemmas rear their ugly heads I will be there to make a mockery of them.
I'd tell you why, but you wouldn't care.
I could make a game where fetus's come back to life as zombies and kill their parents.
Is that a good compromise?
The Undead Unborn !
did you just get tingles right there?
yeah, me too
you have
if(Key.isDown(69)) {
{
gotoAndPlay("Range", 2);
}
}
which is stupid
you want
if(Key.isDown(69)) {
gotoAndPlay("Range", 2);
}
At 12/18/09 03:23 PM, Saza wrote:At 12/18/09 03:22 PM, Mexifry wrote:paint msAt 12/18/09 03:20 PM, Wasim wrote: ms paintms paint
sm tniap
I got started with some as2 tutorials (something like 4 years ago)
trial and error, newgrounds, and google taught me everything I know
also, as2 sucks
it's good for learning, but it sucks overall
use as3
like a man
they say the hypotenuse is equal to the square root of the sum of both sides squared.
A^2 + B^2 = C^2
IE:
var xdif:Number = obj1.x - obj2.x;
var ydif:Number = obj1.y - obj2.y;
dist = Math.sqrt(xdif*xdif + ydif*ydif)
I'm not sure you understand how DisplayObjectContainers and children work.
first you have to make a movieClip
public var mainmenu:MainMenu = new MainMenu();
now you have to add it, keep in mind that what you put before the addChild is the movieClip that you're putting the new movieClip inside.
you did this
addChild( mainmenu );
this code adds mainmenu to the class you're in (StartGame)
you then ran the code
parent.removeChild(this);
this removes StartGame from the stage and since MainMenu is inside it, MainMenu gets removed too.
the solution is to do this
parent.addChild(mainmenu);
this adds MainMenu to the stage instead of adding it to StartGame
can't believe I just made that mistake, forgot to fix the comma thing too
function authcheck(evt:MouseEvent) {
if (ID_input.text == "447839" && Password_input.text == "33227") {
gotoAndStop("authgood");
} else {
gotoAndStop("authbad");
}
}
logbtn.addEventListener(MouseEvent.CLICK , authcheck);
fixed
function authcheck(evt:MouseEvent) {
if (ID_input.text == "447839", Password_input.text == "33227") {
gotoAndStop("authgood");
} else {
gotoAndStop("authbad");
}
}
logbtn.addEventListener(MouseEvent.CLICK , authcheck);
try that
The problem is that you keep trying to compare a string and an int.
If you just set the comparison to be a string and a string you'll be fine. (that's why they're in quotes)
Another solution is to cast the string to an int, but I can't remember how to do that. Google it.
Audio makes up a lot of the filesize.
You can compress your audio to save a lot of memory. It would be under publish settings or you can do it manually for each sound.
Animation itself shouldn't take up too much.
well if you're controlling your sound with code (you should be) you can just do this (as3 by the way)
when you want to start your sound
var music:soundChannel = new musicName().play();
then on the frame you want it to stop do this.
music.stop();
make sure you export the music for actionscript first. In the above example musicName would be the name of the sound's class

