Recent posts by stage_phrite on Kongregate

Flag Post

Topic: Game Programming / Question?

alternatively there are currentFrame and totalFrames variables(with underscores if using as2)

so something along the lines of

if(this.currentFrame == this.totalFrames)
{
    //do something
}

in an enter frame event function would work.

 
Flag Post

Topic: Game Programming / Remove animation after completion

Originally posted by Aesica:

Ooh, my bad then, as I think I’ve only tried to use swapDepths once or twice—typically to make crap generated by an enemy appear behind it rather than on top of it.. D:

And this is why you read the documentation if you are unsure, so you don’t go looking silly :p

 
Flag Post

Topic: Game Programming / Remove animation after completion

add

this.swapDepths(_parent.getNextHighestDepth());

inside the if statement before you call the removeMovieClip function.

 
Flag Post

Topic: Collaborations / Programer needed by Watcher Studios

if you have had 5 programmers join and then leave because the project was too big then that should tell you something(ie that you need to give further information about what exactly will be expected of any programmers BEFORE they join, otherwise you will just continue to waste time having people joining and immediately leaving again)

 
Flag Post

Topic: Game Programming / A question for Java programmers

to be honest ooflorents idea of sql databases is the best you are going to get…but if you insist on not following that root then you could also use javas file io classes, some basic tutorials here……

http://docs.oracle.com/javase/tutorial/essential/io/

 
Flag Post

Topic: Game Programming / help with an error

Index out of range errors occur when you are trying to access an element at an array index where there is no existing element, i suspect it is something to do with the value of i on certain occasions but as i can’t see exactly where the value of that is set or updated it is difficult to be more specific

 
Flag Post

Topic: Game Programming / 1158 syntax error in flash as3 please help meeeee

How on earth have you ended up with that as your code?…..anyways regardless i think what you are looking for is…

stop();

btnHelp.addEventListener(MouseEvent.CLICK, GoToScene2);
btnMap.addEventListener(MouseEventListener.CLICK, GoToScene3a);

function GoToScene2(event)
{
    gotoAndPlay("meow");
}

function GoToScene3a(event)
{
    gotoAndPlay(1, "Scene 3a");
}

I would recommend going over some beginner tutorials.

 
Flag Post

Topic: Game Programming / From a programmer standpoint what is this engine missing?

I think Aleczs FOW suggestion is exactly what you need.

I would also extend the half-light idea to any areas around the player that aren’t currently in his FOV though so that you can still see enemies approaching from all direction but without the naff looking light + shadows as demonstrated in BigJM’s post

 
Flag Post

Topic: Game Programming / Software developing software

Originally posted by jheiling:
Originally posted by RTL_Shadow:

If you’re looking to create anything outside of a simple window software then you’re going to have to learn C, there’s really no way around that. If you want you can try VBS, but for the love of all things good do not use it…

Yeah, learning C is the only way… no, wait a second, that was before Microsoft published MFC 20 years ago. Of course that’s only relevant if you’re interested in history, because 10 years ago .net came out.

Nowadays it doesn’t really matter which .net language you chose, use VisualBasic if you like the strange syntax, or C++ if you’re a masochist, or something more exotic like Boo or F#. I would highly recommend to follow feartehstickmans advice though and give C# a try, it’s a nice clean language, it’s not too hard to learn and by far the most popular, so you will find plenty of tutorials.
But it’s really mostly a matter of taste, they are all strongly typed, object oriented, and they use the same library.

This whole post is of course irrelevant if the OP intends to develop for any OS other than Microsuck Winblows

 
Flag Post

Topic: Game Programming / Highlighting hex grid using A* need help

Use either Depth first search or breadth first search algorithms(these are often used in situations where there is no single destination or where the destination isn’t yet known for example in random maze generation)

 
Flag Post

Topic: Game Programming / Effectively finding multiple collisions

for your character add a 2d vector to represent velocity. then when a collision is detected change the value of velocity rather than actually moving the object at this point.

Then once you have left the collision detection for loop update the position of your character based on the 2d vector eg

myCharacter.x += myCharacter.velocity.x * myCharacter.speed;
myCharacter.y += myCharacter.velocity.y * myCharacter.speed;

the values of velocity.x and velocity.y should be set to -1(for moving left or up), 0(for not moving at all in that direction) or 1(for moving right or down)

 
Flag Post

Topic: Game Programming / Looking for a new language to learn. (AKA Debate! Language 2 Lrn)

Originally posted by BobTheCoolGuy:
Originally posted by EndlessSporadic:

Not exactly sure what you mean. Why would you delete everything right after you made it?

The “new” keyword adds items to the heap. The “delete” keyword frees up the memory in the heap. You don’t put it there right after and keep it there. You write it in so you don’t forget it and put code in between. The problem occurs when you new something and forget to delete it later causing memory leaks. Good programmers put both {} in when they write a block of code so they don’t miss a bracket later.

//add int called "c" to the heap (more specifically, c is a pointer to an int on the heap)
int* c = new int;
//c outlives its usefulness - delete it from the heap to eliminate memory leaks
delete c;

What do you mean by flexible exactly here?

You have more control over how exactly your program runs. Complexity isn’t always a bad thing. That being said, if you are in a situation where it doesn’t matter then why would you use something so complex? Other languages can get it done the same way with more overhead.

Ah, that makes more sense. I know C++ somewhat, although I don’t use it frequently. I thought you were saying that your next statement after new was always delete. I was thinking that sure you won’t leave any memory floating around, but it won’t do you much good either. :D

And I agree – C++ is a capable tool no doubt. I just say use the shovel, not the front end loader unless you have to.

If you can find me a similar article written by a programmer who has done something noteworthy then i might actually change my stance….however a freelance web developer is hardly the font of knowledge in terms of programming ability. If you visit any large scale web development company you will find they do not call web developers programmers. There is good reason for this which is that the good programmer = lazy programmer mentality breeds programmers who can only implement solutions to problems that have already been implemented.

There is another major difference between good programemrs and lazy programmers however and that is a matter of motivation. A lazy programmer will attempt to use as much code that has already been written because they are trying to get something for nothing. A good programmer on the other hand will attempt to use code already written + write their own reusable code so that they can invest less time writing code they already know how to write and spend more time reading, learning and experimenting in areas of programming they currently know little about or struggle with.

Now for those with issues of new and deletes in c++ you could always use smart pointers.

http://www.boost.org/doc/libs/1_50_0/libs/smart_ptr/smart_ptr.htm

 
Flag Post

Topic: Game Programming / Looking for a new language to learn. (AKA Debate! Language 2 Lrn)

Originally posted by BobTheCoolGuy:
Originally posted by stage_phrite:
Originally posted by BobTheCoolGuy:
Originally posted by stage_phrite:

Unfortunately the general trend with modern hobbyist developers(who have the time to comment regularly on threads like this) is with taking the concept of not reinventing the wheel to a ridiculously high extreme. I’m pretty sure some would even go as far as to find a game engine that allowed the creation of a game without writing a single line of code but still calling themselves a programmer(if 1 where available).

So in general the “programmers are lazy” comment is valid….but only when it relates to the majority of modern day hobbyists.

Wrong – the best programmers are the laziest in the long term. They know how to write the least amount of code exactly how the situation calls for. If they know their program will never be used again, they might not bother making the code ultra maintainable / documented. If they’re working on a massive project, they’ll realize that writing flexible code then will save a ton of work in the future. Laziness is a key to programming – a good programmer doesn’t waste a line of code.

This is what is generally known as not looking at the bigger picture. The best programmers know how to write the least amount of code because they invest the time perfecting their art. Therefore they are not lazy but rather invest their time more productively

Eh, I think you’re just arguing semantics. I call it lazy, you call it productive, they’re the same thing really :D

3rd: Macros/Generics – these can be quite difficult to understand when reading others code

Everything can be quite difficult for others to understand. There is no difference between well written game code and well written macros. There is no difference between bad code either.

True, but you have to admit, generics in C++ are unnecessarily complex.

4th: Errors are normally much harder to understand

That is the IDE’s fault if I am correct. Visual Studio does a horrible job of documenting errors in C++. It also lacks auto-complete. Then again, if you structured your code correctly it wouldn’t be a problem. If you put a delete immediately after each new instead of putting it off until later things like that wouldn’t happen. I wouldn’t blame the language for the incompetence and bad habits of the programmer.

Not exactly sure what you mean. Why would you delete everything right after you made it? Compiler errors of course are controlled by the compiler, not sure about runtime errors.

6th: Heck, it doesn’t even have Strings built in

C++ is an extension of C. Why should they add it in if it is already made somewhere else? You said it yourself. Programmers are lazy. Why should they reinvent the wheel? It is included in the STL. Writing one line of code to include strings is SO difficult.

Eh, not buying the extension argument :D However, you’re right, it’s not hard to use, but then again, I’d be surprised if it’s even been around as long as c++ – so maybe now it doesn’t really matter, but in the past it may have.

It definitely is more complex than higher level languages

It is also more flexible.

What do you mean by flexible exactly here?

How exactly are productive and lazy the same thing? I’m intrigued by this statement.

 
Flag Post

Topic: Game Programming / Looking for a new language to learn. (AKA Debate! Language 2 Lrn)

Originally posted by BobTheCoolGuy:
Originally posted by stage_phrite:

Unfortunately the general trend with modern hobbyist developers(who have the time to comment regularly on threads like this) is with taking the concept of not reinventing the wheel to a ridiculously high extreme. I’m pretty sure some would even go as far as to find a game engine that allowed the creation of a game without writing a single line of code but still calling themselves a programmer(if 1 where available).

So in general the “programmers are lazy” comment is valid….but only when it relates to the majority of modern day hobbyists.

Wrong – the best programmers are the laziest in the long term. They know how to write the least amount of code exactly how the situation calls for. If they know their program will never be used again, they might not bother making the code ultra maintainable / documented. If they’re working on a massive project, they’ll realize that writing flexible code then will save a ton of work in the future. Laziness is a key to programming – a good programmer doesn’t waste a line of code.

This is what is generally known as not looking at the bigger picture. The best programmers know how to write the least amount of code because they invest the time perfecting their art. Therefore they are not lazy but rather invest their time more productively

 
Flag Post

Topic: Game Programming / Looking for a new language to learn. (AKA Debate! Language 2 Lrn)

Unfortunately the general trend with modern hobbyist developers(who have the time to comment regularly on threads like this) is with taking the concept of not reinventing the wheel to a ridiculously high extreme. I’m pretty sure some would even go as far as to find a game engine that allowed the creation of a game without writing a single line of code but still calling themselves a programmer(if 1 where available).

So in general the “programmers are lazy” comment is valid….but only when it relates to the majority of modern day hobbyists.

 
Flag Post

Topic: Game Programming / Robot Game

do you want it to recharge over a period of say 30 seconds or just instantly recharge?

 
Flag Post

Topic: Game Programming / Looking for a new language to learn. (AKA Debate! Language 2 Lrn)

Either C++(with an API like wxWidgets or QT) or Java(possibly with the JavaFX API for prettier UIs)

Generally there is not much to make you choose 1 over the other. Both are capable of creating executable files(by executable i am of course talking about double click = run program rather than just the .exe extension). Both have numerous free compiler and IDE’s you can use and there are a ridiculous number of websites dedicated to tutorials for both languages.

 
Flag Post

Topic: Game Programming / C++ Inheritence Help

Originally posted by EndlessSporadic:

Vector Vector::operator+(Vector &p)
{
Vector outV;
outV.setX(getX() + p.getX());
outV.setY(getY() + p.getY());
outV.setZ(getZ() + p.getZ());
return outV;
}

Quick question about this. I read that you should not return a local variable in C++ since it would be returning a variable that goes out of scope (thereby giving you an error). Is this only for references and pointers or is it for everything?

That is only for references and pointers. With standard variables when returning it makes a copy…….with pointers and references it sends a position in memory(which could contain data when returned but then be empty when actually used)

 
Flag Post

Topic: Game Programming / C++ Inheritence Help

JamesObscura is correct…..when using pointers or references you use an arrow(→) instead of a dot to access member functions and variables.

 
Flag Post

Topic: Game Programming / State Transitions

The issue is that you have misunderstood the purpose of xVelo + yVelo. The updateLocation function in the actor class will be linked to the onEnterFrame event. In that function it updates the position of the object by adding the value of xVelo to x and yVelo to y.

In your code before the updateLocation function is ever called you:

1. set the value of yVelo to -speed 9 times.
2. run a while loop that runs until the object is at the same location in y as it was before the jump started(which it will be because updateLocation has not been called yet)
3. reset the value of yVelo to 0.

So….

regardless of the fact you have a for loop and a while loop; by the time the code that actually moves objects(the code in the updateLocation function) is called the value of yVelo is 0 and therefore the object does not move on the y axis. The same will be true in respect to xVelo + no movement in the x axis when attempting to run and jump.

The quickest way for you to get the jump working(though not the best + not as well designed as the rest of the code) is to simply replace

super.yVelo = -speed; and super.yVelo = speed;

with

this.y -= speed; and this.y += speed;

then in addition to these in the running jump change

super.xVelo = (speed * this.scaleX);

to

this.x += speed * this.scaleX;

I would definately recommend you invest a little more time figuring out what these classes you are “Borrowing” actually do though.

 
Flag Post

Topic: Game Programming / Problems with a tile builder

In addition to Ambitious’ spot you have an issue with the second for loop.

the maximum value of c * 8 – 1 is 15. So basically after you reach the 16th(because indices start at 0) element in the array you will never trigger tileRow++

Edit: A more reliable solution for getting 2 dimensional coordinates from a 1 dimensional array is this:

    row = int(index / cellsPerRow);
    column = index % cellsPerRow;

    if(index % cellsPerRow == 0)
    {
        //increase row by 1 here
    }
 
Flag Post

Topic: Game Programming / State Transitions

Originally posted by FlashGrenade:

had to pop in arguments to prevent an error

and there is an updateLocation function in my actor class otherwise i wouldnt be able to move.

the for loop makes you jump in the air until the jumpcounter hits 9 (11 if you jump as you run) and the while loop lets gravity kick in.

This is what i’m saying……super.yVelo = -speed; for example does not by itself move the object on the y axis it just changes the speed at which the updateLocation function should move the object in the y axis each frame.

 
Flag Post

Topic: Game Programming / State Transitions

for (var j:int = 0; j<= 9; j++) {
							trace(j);
							super.yVelo = -speed;
							super.xVelo = 0;
							if (key.isDown(74) && !(SlashLOCKED)){
							this.gotoAndStop('jumpSlash');}
							if (key.isDown(75) && !(KickLOCKED)) {
							this.gotoAndStop('jumpKick'); }
							if (key.isDown(32) && !(JumpLOCKED)) {
							heroSM.changeState("backFlip");}
						}//for (var j:int = 0; j<= 9; j++)
							trace(this.y);
							trace(this.zCoordinate);
						
						while (this.y < this.zCoordinate) {
							super.yVelo = speed;
							super.xVelo = 0;
							if (key.isDown(74) && !(SlashLOCKED)){
							this.gotoAndStop('jumpSlash');}
							if (key.isDown(75) && !(KickLOCKED)) {
							this.gotoAndStop('jumpKick');}
						}//	while (this.y < this.zCoordinate) 

what exactly are you expecting this code to do? From looking at the variable names it looks to me like you are setting the speed at which your character should move in the yAxis 9 times(without actually moving it) then performing a while loop(which will never trigger its inner logic as your character isn’t actually moving)

There will likely be an update function in the actor class that needs to be overridden in your hero class to perform the actual movement.

 
Flag Post

Topic: Game Programming / Java sucks.

why was my post removed? lol

 
Flag Post

Topic: Game Programming / Java sucks.

well tbf it was less than 5 mins of googling lol but ok…here is a webpage for a javascript audio + video player
http://jplayer.org/

states it works in these:

Windows: Firefox, Chrome, Opera, Safari, IE6, IE7, IE8, IE9 OSX: Safari, Firefox, Chrome, Opera iOS: Mobile Safari: iPad, iPhone, iPod Touch Android: Android 2.3 Browser Blackberry: OS 7 Phone Browser, PlayBook Browser