Jackolantern is spot on. Your problem was not coding, it was coding too soon. When working on the various Angela modules, I design them – TWICE – before coding. I make a design, with all of my classes, attributes, operations and logic flows. In short, I have a program in my head, on paper, or in Visio as in my usual case. Then I try to think of all of the problems with it and fix those problems and come up with a V2 design. I usually code the V2 design. Just remember, there is a 99.999999% chance that you will throw out V1 after you find problems with it. You can either throw out a design, or a lot of code.
D3luxe, not knowing anything about how your tower defense game works, it sounds like you are inadvertently sharing a variable among towers. This easily happens in languages that use pointers. Let me give an example. I’ll create a new variable:
B = 5
Now I’ll create a new one:
A = B
Then I change B:
B = 2
You might expect that A = 5. But if A is not 5, but is actually a “pointer” to the place in memory where the value of B is stored, then what you’ll actually be getting is 2. Different languages behave differently there and have different ways to deal with it.
I hate coding with a passion,
Re: I hate coding with a passion,
Yes, I know my problems. Like I said, it was more of a learning experience to actually learn the structure of the language rather than to actually make a fully-working amazing game.Cayle wrote:Jackolantern is spot on. Your problem was not coding, it was coding too soon. When working on the various Angela modules, I design them – TWICE – before coding. I make a design, with all of my classes, attributes, operations and logic flows. In short, I have a program in my head, on paper, or in Visio as in my usual case. Then I try to think of all of the problems with it and fix those problems and come up with a V2 design. I usually code the V2 design. Just remember, there is a 99.999999% chance that you will throw out V1 after you find problems with it. You can either throw out a design, or a lot of code.
D3luxe, not knowing anything about how your tower defense game works, it sounds like you are inadvertently sharing a variable among towers. This easily happens in languages that use pointers. Let me give an example. I’ll create a new variable:
B = 5
Now I’ll create a new one:
A = B
Then I change B:
B = 2
You might expect that A = 5. But if A is not 5, but is actually a “pointer” to the place in memory where the value of B is stored, then what you’ll actually be getting is 2. Different languages behave differently there and have different ways to deal with it.
And yes, you're somewhat right about the structure of the towers. I am sharing a common variable between them, but not in the sense that you're thinking. I realize that if A = B and i change B, then A changes as well. How I have it though, which is more of me not knowing the language, is I thought how the Child features work in Flash that they would create their own seperate variable, in a sense. Of course I was wrong, but I'm not sure yet if I'll actually be able to save the code I have for the towers or if it would be easier to rewrite them.
Adobe Photoshop CS4/Illustrator CS4
Adobe Flash CS4
3DS Max & Maya
PC Spec:
Intel Core 2 Quad Q9550 (2.8ghz)
8gb 800Mhz DDR2 RAM
1gb nVidia GTX275
2TB SATA HD
Windows 7 RTM
Adobe Flash CS4
3DS Max & Maya
PC Spec:
Intel Core 2 Quad Q9550 (2.8ghz)
8gb 800Mhz DDR2 RAM
1gb nVidia GTX275
2TB SATA HD
Windows 7 RTM
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: I hate coding with a passion,
ActionScript doesn't allow your classes to have individual instance variables? How could someone work around that? Or am I just misunderstanding the problem?D3luxe wrote:Yes, I know my problems. Like I said, it was more of a learning experience to actually learn the structure of the language rather than to actually make a fully-working amazing game.Cayle wrote:Jackolantern is spot on. Your problem was not coding, it was coding too soon. When working on the various Angela modules, I design them – TWICE – before coding. I make a design, with all of my classes, attributes, operations and logic flows. In short, I have a program in my head, on paper, or in Visio as in my usual case. Then I try to think of all of the problems with it and fix those problems and come up with a V2 design. I usually code the V2 design. Just remember, there is a 99.999999% chance that you will throw out V1 after you find problems with it. You can either throw out a design, or a lot of code.
D3luxe, not knowing anything about how your tower defense game works, it sounds like you are inadvertently sharing a variable among towers. This easily happens in languages that use pointers. Let me give an example. I’ll create a new variable:
B = 5
Now I’ll create a new one:
A = B
Then I change B:
B = 2
You might expect that A = 5. But if A is not 5, but is actually a “pointer” to the place in memory where the value of B is stored, then what you’ll actually be getting is 2. Different languages behave differently there and have different ways to deal with it.
And yes, you're somewhat right about the structure of the towers. I am sharing a common variable between them, but not in the sense that you're thinking. I realize that if A = B and i change B, then A changes as well. How I have it though, which is more of me not knowing the language, is I thought how the Child features work in Flash that they would create their own seperate variable, in a sense. Of course I was wrong, but I'm not sure yet if I'll actually be able to save the code I have for the towers or if it would be easier to rewrite them.
The indelible lord of tl;dr
Re: I hate coding with a passion,
You're misunderstanding the problem I believe. I don't know exactly hwo to explain what I mean, but it doesn't really matter because I was wrong anyway. But yes, classes are allowed to have individual instance variables in AS.Jackolantern wrote:ActionScript doesn't allow your classes to have individual instance variables? How could someone work around that? Or am I just misunderstanding the problem?D3luxe wrote:Yes, I know my problems. Like I said, it was more of a learning experience to actually learn the structure of the language rather than to actually make a fully-working amazing game.Cayle wrote:Jackolantern is spot on. Your problem was not coding, it was coding too soon. When working on the various Angela modules, I design them – TWICE – before coding. I make a design, with all of my classes, attributes, operations and logic flows. In short, I have a program in my head, on paper, or in Visio as in my usual case. Then I try to think of all of the problems with it and fix those problems and come up with a V2 design. I usually code the V2 design. Just remember, there is a 99.999999% chance that you will throw out V1 after you find problems with it. You can either throw out a design, or a lot of code.
D3luxe, not knowing anything about how your tower defense game works, it sounds like you are inadvertently sharing a variable among towers. This easily happens in languages that use pointers. Let me give an example. I’ll create a new variable:
B = 5
Now I’ll create a new one:
A = B
Then I change B:
B = 2
You might expect that A = 5. But if A is not 5, but is actually a “pointer” to the place in memory where the value of B is stored, then what you’ll actually be getting is 2. Different languages behave differently there and have different ways to deal with it.
And yes, you're somewhat right about the structure of the towers. I am sharing a common variable between them, but not in the sense that you're thinking. I realize that if A = B and i change B, then A changes as well. How I have it though, which is more of me not knowing the language, is I thought how the Child features work in Flash that they would create their own seperate variable, in a sense. Of course I was wrong, but I'm not sure yet if I'll actually be able to save the code I have for the towers or if it would be easier to rewrite them.
Adobe Photoshop CS4/Illustrator CS4
Adobe Flash CS4
3DS Max & Maya
PC Spec:
Intel Core 2 Quad Q9550 (2.8ghz)
8gb 800Mhz DDR2 RAM
1gb nVidia GTX275
2TB SATA HD
Windows 7 RTM
Adobe Flash CS4
3DS Max & Maya
PC Spec:
Intel Core 2 Quad Q9550 (2.8ghz)
8gb 800Mhz DDR2 RAM
1gb nVidia GTX275
2TB SATA HD
Windows 7 RTM