randomcomm3nt
20 posts
|
Topic: Game Programming /
Clone function problems
ARGH FUUUUUUUU…..
All of this was because I had one letter mistyped. Disregard EVERYTHING I said, I suck cocks.
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Clone function problems
No, wait, it doesn’t. Not quite anyway. My problem isn’t solved, but its not happenening where I think it is.
S0orry for wasting your time ¬¬
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Clone function problems
Hmm, strange thing is, if I make it so Clone() returns different things, they are seperate instances. If I don’t, they are the same. Example:
public function Clone() : Monster
{
var m : Monster = new Monster();
m.id = id;
return m;
}
monster2 = monster1.Clone();
monster3 = monster1.Clone();
monster2.x = 300;
monster3.x = 400;
trace(monster2.×.toString()); // traces “400”
Now if I do the exact same thing except with clone as
public function Clone() : Monster
{
var m : Monster = new Monster();
m.id = id;
id++;
return m;
}
because the two clones return different values, trace now sends “300”
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Clone function problems
public function Clone() : Monster
{
var m : Monster = new Monster();
m.x = x;
m.y = y;
m.id = id;
m.monsterName = monsterName;
m.speciesName = speciesName;
m.attack = attack;
m.defence = defence;
m.accuracy = accuracy;
m.speed = speed;
//TODO: copy moves
m.health = health;
m.maxHealth = maxHealth;
m.energy = energy;
m.maxEnergy = maxEnergy;
m.sprite = sprite;
m.combatImage = new Bitmap(combatImage.bitmapData.clone());
return m;
}
If I call
monster2 = monster1.Clone();
monster3 = monster1.Clone();
where
monster1 has memory pos (396c061)
I end up with
monster2 has memory pos (396ce71)
monster3 has memory pos (@396ce71)
Basically, one is a reference to the other, or they are both references
to the same thing. But I want them to be unique instances with the same data.
So I traced what was happening. Basically every time “var m : Monster = new Monster();” is called, it assigns m the same memory slot, so basically, every time you call a function of a class that returns something, it actually returns a reference to the local variable that was returned. Calling that function again then negates overwrites the value that was returned the first time the function was called. Amirite? If so, WHY? Is there an easy way to get around this because it seems kind of retarded.
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Game Maker
“nukes, really powerful, good in good hands”
WAIT WHAT?
manages to not get into politics
Having used Game Maker for a while, my main objections are:
- It’s slow.
- File sizes are large (an empty project with nothing in is a couple of MB)
- Can only be uploaded to one website, which isn’t that good.
- Programming language isn’t that good (not powerful, intuitive or efficient)
EDIT: Should say, it IS definitely good to learn from, but people should definately move onto something better afterwards.
EDIT2: Oh, and the fact that half the features are cut out unless you pay.
|
|
|
randomcomm3nt
20 posts
|
Topic: Collaborations /
Monster and items and other game content nouns
And this almost seems inspired by Well of Souls, but I doubt it :P
So umm, every RPG (and whatever a roguelike is) needs a giant rat ;)
[END]
although tbh, its hard to assign str, dex etc values without knowing how your system works
|
|
|
randomcomm3nt
20 posts
|
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Game Development Room (GDR)
Mute option would be nice. Sound’s good when I’m having a conversation, but when I’m trying to play a game and have it open, gets a little annoying. Loving the whole project though, so thank you :)
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Multiple types of Enemy
Originally posted by BobTheCoolGuy:
Or, when creating the enemy, just have a parameter in the constructor for type, and set stuff based on that.
That’s the plan, but I don’t know how to change the image. I think I will just use the frames idea…
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Multiple types of Enemy
Originally posted by qwerber:
Make base class Enemy with variables like damage and health.
Make classes Enemy1 and Enemy2 that extend Enemy.
Make them have different properties.
No.
I’m sorry, but as someone who is used to programming in C#, I refuse to do something that retarded. Making a new class just to change the value of a variable is a waste of time and space. They call them variables for a reason, because they vary. They are MEANT to vary between instances.
In C# with XNA, I was rendering about 25 different objects from 4 classes. (And would have done about twice that if I could be bothered to make new sprites).
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Multiple types of Enemy
I suppose I could edit Enemy so that each frame is a different image, and then just put it on the frame that corresponds to the type of enemy?
Is there a better way?
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Multiple types of Enemy
Okay so I have an enemy class with variables like damage, speed etc.
What I want to know is how to load several types of enemies into Flash (using AS3). I have looked up a couple of tutorials on XML, so I know I can use that to load the data, but how do I have multiple enemies with different sprites?
The shootorials just tell you to make a new class for everything, but I don’t believe a language like AS3 wouldn’t implement polymorphism, so there MUST be a way to change the image of an object?
Thanks in advance.
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Instance Names in AS3
Yeah I see now. I was originally thinking about how you can’t reference objects added to scenes by there instance names (or at all unless I’m mistaken). But I see now that you can assign instance names to subcomponents of objects and use them there…
|
|
|
randomcomm3nt
20 posts
|
Topic: Game Programming /
Instance Names in AS3
What is actually the point of using instance names in Flash when using AS3, as they cannot be used for anything?
|
|
|
randomcomm3nt
20 posts
|
|
|
|
randomcomm3nt
20 posts
|
Topic: Anti-Idle: The Game /
Ants are back
Right so I didn’t refresh, just allowed my computer to go standby a few times. As result I’ve noticed:
a) Truck loads of exp and gold
b) My tree timers keep resetting.
Can anyone explain this?
|
|
|
randomcomm3nt
20 posts
|
Topic: Anti-Idle: The Game /
Ants are back
Still no ants. Levelled from 179 to 223 (approx), and got about 5x as much exp as the day before.
|
|
|
randomcomm3nt
20 posts
|
Topic: Anti-Idle: The Game /
The best stadium starting abilities?
Just to clarify, you don’t have to alternate the left and right keys, just SPAM them.
|
|
|
randomcomm3nt
20 posts
|
Topic: Anti-Idle: The Game /
Stadium Tactics
How do you get more ability points?
|
|
|
randomcomm3nt
20 posts
|
Topic: Anti-Idle: The Game /
Protips
Protip : Reassigning skill points costs nothing. Before idling in the battle arena, put as many skill points on Auto-fight as possible, then when you plan to stop idling, reassign them.
Mystery rate upgrade generates an extra 50 mp per 5 minutes, and lasts all day. It costs 1500, so after 150 minutes (2.5 hours) you will earn back your 1500 and be making a profit.
Protip : If you are planning on playing more than 2 hours 30 (including idle time) then: “Buy Mystery Rate Upgrade”; ???; Profit.
|