Recent posts by Nolander777 on Kongregate

Flag Post

Topic: Game Programming / How to Prevent Global Namespace Pollution in C++

I’m not sure if there is a super safe and elegant way to do it, but would this work?

#ifndef ARRAY_H
#define ARRAY_H

#pragma once

#ifndef ARRAY_H_NOINCLUDE_STRING_H
#include <string.h>
#endif

#define FORCEINLINE __forceinline

template <typename T>
class Array
{
public:
    FORCEINLINE Array()
    {

#ifndef ARRAY_H_NOINCLUDE_STRING_H
        //Do something with T here that requires something from string.h
#endif
    }
{
#endif //ARRAY_H

#pragma once

#define ARRAY_H_NOINCLUDE_STRING_H
#include "Array.h"

class MyOtherClass
{
    Array<int> ArrayOfInts;
    
public:
    FORCEINLINE MyOtherClass()
    {
         //Crap from string.h included in Array.h is polluting the global namespace
    }
}

The include guards arent necessary, but are generally good practice. Also, if another source file needs array.h to include string.h, then it could #undef the macro in a similar way. I THINK this would work.

 
Flag Post

Topic: Game Programming / Convert Shape or Polygon Boundaries To X and Y Coordinates

In general I don’t know of something that can do that, but in this specific instance, would it not be easier just to consider your shape as two shapes: a rectangle overlayed on top of a circle?

 
Flag Post

Topic: Game Programming / Using one game loop (stage.addEve....(enterFram..)

I usually implement something like a state machine:

private var stateFunction:Function;

private function onEnterFrame(e:event):void{
   frameCounter++;
   if(stateFunction == null){
      stateFunction = firstFunction;
   }
   stateFunction();
}

private function firstFunction():void{
   ///do something using frameCounter as a control
   //maybe change stateFunction to another function 
}

private function secondFunction():void{
   ///do something using frameCounter as a control
   //maybe change stateFunction to another function 
}

  //third function, fourth, fifth, etc
 
Flag Post

Topic: Game Programming / Selecting a target with a mouseEvent

Why does your attacking character have to “listen” for the attack. Why can’t it just be told when to react?

private function attackCharacter(e:Event):void{
   attackingCharacter.typedAttack(e.target as Character);
}
 
Flag Post

Topic: Game Programming / Text based rpg

Be sure to spell check

 
Flag Post

Topic: Game Programming / Good Rating or good players?

If the scores don’t affect anyone else, I would let the user have fun with my game however they want.

 
Flag Post

Topic: Game Programming / Alternative to actionscript

It depends what you are trying to program honestly. Java isn’t even a real alternative to AS3 unless you are creating a really simple tool or perhaps an android app. Those are the only two uses where the languages’ program potential cross paths.

 
Flag Post

Topic: Game Programming / How do I download AS3?

http://www.flashdevelop.org/

 
Flag Post

Topic: Game Programming / c++ memory question

Originally posted by Multihunter:

Oh…. this is embarrassing.

I’m terribly sorry, Nolander777. I have wronged you by not correctly reading the function. I thought it was returning the reference to the array inside the struct.
Your function is the best solution… sorry about that.

hey no need to apologize

 
Flag Post

Topic: Game Programming / c++ memory question

Originally posted by Multihunter:
Originally posted by Nolander777:

static myStruct* foo(){
myStruct* a = new myStruct;
a→theArray = new Array();
return a;
}

That function would cause a memory leak, wouldn’t it? Since you don’t actually have a pointer to the object once the function closes.

A pointer is just a number that refers to a memory location. They always pass by value. returning ‘a’ would return the pointer to the new struct allocation.

‘a’ is being allocated on the stack and will be deleted when the function returns, but not before its value is returned.

 
Flag Post

Topic: Game Programming / c++ memory question

if you are doing something like this:

static myStruct foo(){
myStruct a;
a.theArray = new Array();
return myStruct;
}

then myStruct is being allocated on the Stack memory. When the stack unwinds (e.g. when foo() returns), myStruct will be deleted, (and apparently so would the array).

If you do this:


static myStruct* foo(){
myStruct* a = new myStruct;
a→theArray = new Array();
return a;
}

then your struct will be dynamically allocated on the heap, and will not be destroyed until you do

delete mystructpointer;//where mystructpointer is a pointer to your struct
 
Flag Post

Topic: Game Programming / Try my game!

“You win!” isn’t even centered on the stage . aragaekafleflakfmlkadmflaknfelanfl

 
Flag Post

Topic: Game Programming / Game Idea - Stamina based RPG

The forums aren’t your personal idea notebook. This is the programming forum. What are you trying to discuss?

 
Flag Post

Topic: Game Programming / as3 getting e.targets

Excellent point

 
Flag Post

Topic: Game Programming / as3 getting e.targets

Originally posted by CuriousGaming:



if (event.target is Enemy)
{
event.target.gotHit(damage);
}

Should either be

with(event.target as Enemy)
{
	event.target.gotHit(damage);
}

or

if (event.target is Enemy)
{
	(event.target as Enemy).gotHit(damage);
}
 
Flag Post

Topic: Game Programming / as3 getting e.targets

Event.target is defined as an Object. The Object class does not have a health property. If you want to access the health property, you have to cast it as the actual class of the object.
So,

function targets(e:Event):void{
var myobject:ClassWithHealthProperty;
myobject = e.target as ClassWithHealthProperty;// this will throw an exception if e.target is not a ClassWithHealthProperty.
myobject.health = myobject.health - 1;
}
 
Flag Post

Topic: Game Programming / [AS3] Dynamically alter specific hue

a light to dark gradient only I believe. The ‘H’ value should be the same

 
Flag Post

Topic: Game Programming / [AS3] Dynamically alter specific hue

Hey everyone,

What would be the most efficient way of altering a specific hue with varying light and darkness in a bitmapdata without affecting the other colors?

 
Flag Post

Topic: Game Programming / Can you export a movieclip using Adobe Flash Professional CS6

Alternatively, you can export the movieclip as a .swf file and add it to your assets folder. Then you can embed the ‘symbol’ file (found by expanding the .swf in the explorer) into your code like you would a .png or .svg .

 
Flag Post

Topic: Collaborations / Need artist for flash game

Hello,

I’m a new developer working on my first big release. I’m in need of an artist to create some assets for me.

I’m looking for vector graphics. I haven’t decided on the exact style I want, but if you are interested you can send me your portfolio.

Right now, I need the following assets:

— 3 650X450 animated backgrounds

— 1 to 2 650×450 static backgrounds

— ~10 animated entities (4 -7 short animations)

— 1 animated entity (11 – 15 short animations)

— 5 to 10 special effect animations

— A dozen or so small static images

The vision I have in my mind for these assets is comparable to the style and quality found in Epic Battle Fantasy 3/4, for example. But again, I haven’t decided for sure.

For the work listed above, I offer a negotiable set payment of 400.00 USD. The payment is to be distributed in 10 or so smaller payments (negotiable). Further or substitute compensation (such as revenue sharing) can be negotiated.

Of course, I will give you appropriate credit in-game.

(I plan on designing the buttons, frames, text, symbols, etc. myself. Let me know if this bothers you.)

Any questions or comments can be made here, or by email: ntr11_92@hotmail.com.

Thank you,

Nolander

 
Flag Post

Topic: Collaborations / Competetive Rates for Artists

Hey, everybody.

My game is starting to come together and I’m thinking about hiring an artist. But before I hire somebody I want to do a little research.

How much should I expect to pay an artist to make the assets for a game like Burrito Bison, for example? (Similar quantity and quality of assets)

If you’re an artist here, what compensation would you expect?

 
Flag Post

Topic: Game Programming / Simple question on HOW to create a movieclip?

Originally posted by Bulbopon:

Oh okay thanks that makes sense, never knew you could embed swf’s. So now I’m wondering… if you embed an swf, is there a way to make the swf do different things? For example, have an “idle” animation and then when I need it, an “attack” animation? This seems super easy on a movieclip (goToAndPlay method) but not sure if swf’s have the same functionability

edit: Nevermind, googled it and found out you can just cast the swf has a MovieClip and that should work. Thanks for the responses!

Yes, that’s how you do it. Just like you would cast a class object embedding a .png image as a Bitmap. Because as far as I’m aware, you aren’t actually embedding the entire swf, just the frame images.

 
Flag Post

Topic: Game Programming / Simple question on HOW to create a movieclip?

As long as you can export the animations as swf files, you can embed the symbol in your code, like you would a png. You’ll get something like, [Embed(source=“../../../lib/foo.swf”, symbol=“foo”)]. Edit that code to read: [Embed(source=“../../../lib/foo.swf”)]. That’s how I do it.

 
Flag Post

Topic: Game Programming / How to Give Yourself a Heart Attack

If you’re using GitHub you don’t need dropbox. Also, private repositories are not free.

 
Flag Post

Topic: Game Programming / Dojo Dodger

my game got stuck after level 5 as well