RTL_Shadow
1023 posts
|
Topic: Game Programming /
AS3 Get and Set Methods
Another example; say you have a health bar and a health variable. Chances are you want the two to be linked, so when your health is at 50% you also have your bar at 50% width. Instead of setting the width whenever you set your health, you can do this:
public function set health(h:int):void
{
_health = h;
healthBar.scaleX = h / maxHealth;
}
public function get health():int
{
return _health;
}
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Hoard Evader (Beta)
Don’t use the timeline, use classes.
And use something like fastswf instead of kongregate too.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Using music in my game
Originally posted by GameBuilder15:
Originally posted by I_love_you_lots:
Being an audio designer, I have a severe distaste for compressing SFX and music. I think it actively makes the game worse. I would opt for streaming, like Bob said.
I believe the term you’re looking for is “sound designer,” and I am one as well. xD
How is audio and sound designer different? They are exactly the same…
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Kong API with MySQL?
Originally posted by Drakim:
If Unity3D was to communicate directly with MySQL, it would require the MySQL password to be embedded in the Unity3D app that gets given out to all your players, which is a very very bad idea.
Hence this
(this kind of portrays Tommy in a bad light, but there is a bit more to the story and he’s actually a pretty cool guy from what I’ve seen)
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Deeper Topic (part 3): Events to the rescue!
Originally posted by Drakim:
I pretty much only use blitting, so I have little experience. Couldn’t you possibly make some sort of MovieClipHolder component?
If it doesn’t extend DisplayObjectHolder/Sprite/MC I can’t add to it, though.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Deeper Topic (part 3): Events to the rescue!
Instead of using a PositionComponent I decided to make my Entity class extend DisplayObjectContainer, this way I can add Sprites and such from my assets file.
Edit: The problem with this is now it has a ton of built in functions. Components are a bit hard to get working with standard Flash classes like Sprite/MovieClip.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Open Source Isometric Game
Originally posted by Ace_Blue:
Do you have a road map that goes with this project? If I was to contribute I’d face two primary hurdles:
1) I’m afraid I’m going to mess up something for someone else or duplicate their effort.
2) I don’t know what the final project should look like.
I feel like I’ve been given access to the construction site for the new opera. I can use all the materials and tools that are here to help with the construction, but not consult the architect’s plans. I don’t want to start building a staircase just to be told it’s standing in the middle of the auditorium and has to be taken down, you know.
I don’t have a roadmap. That’s the beauty. The whole point of the project is to create innovation and represent the developer community by seeing what they can collaborate on. With 100 different visions we could come up with some interesting games.
Originally posted by NineFiveThree:
as3isolib is open source, why start from the ground up?
Partly because I wanted to try components and isometry, and generally this will leave a bit more room for innovation.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Open Source Isometric Game
I’m in the progress of making an Isometric Game that’s open source. My goal is to start from the ground up completely open source so I and the community can build a fun flash game. Right now there isn’t much in it, so I’m asking ya’ll to check it out:
https://github.com/RTLShadow/IsoGame
If you have a free few hours I’d love if you guys could check it out/favorite and maybe contribute.
Thanks.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Deeper Topic (part 3): Events to the rescue!
How exactly would I add a DisplayObject from a swc using this method?
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Collision detection fail
Originally posted by jerimo:
State a case where it gives a decimal number using the proposed method, and we shall see then?
As for your “output values in the comments” You output one value and yet show three values, unless you are using the three ints you declared, i, t, and x, at which point it also doesn’t make sense, as x should be the same in all instances as you are doing the same thing. So which is it?
I may be reading the code wrong, AS3 is not my language; I abide to C++
imp2 is correct in this case, no matter how valid the calculation you can easily end up with a floating point error, like 2.000001. Also, t he three numbers are three different tests.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
How Do You Pronounce...
Car, var, Jason, E C M A Script.
How do you guys pronounce these:
HaXe (hex)
Instantiate (In-stan-tee-ate)
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Collision detection fail
Originally posted by aenil333:
Im trying to understand your simple (x – x % TileWidth)/tileWidth and i just cant figure out how im gonna recognize a tile with a math equation. There is something im missing
Assume x is 200 and tilewidth is 32.
(200 – 200 % 32) / 32
(200 – 8) / 32
192 / 32
6
Therefore a point at 200 x is at cell 6 (in x terms, not including y)
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Deeper Topic (part 3): Events to the rescue!
Originally posted by Drakim:
There is a nifty trick to avoiding double collisions that has nothing to do with components.
First I’ll show a loop where we do suffer from double collisions. All it does is
for(j=0; j < enemyList.length; j++) {
for(i=0; i < enemyList.length; i++) {
if(i == j) {continue;} //Don't check collision against yourself!
CollisionManager.check(enemyList[i],enemyList[j]); //Check collision between enemy i and enemy j
}
}
Now, let’s rewrite the loop slightly to avoid the double collision:
for(j=0; j < enemyList.length; j++) {
for(i=j+1; i < enemyList.length; i++) {
CollisionManager.check(enemyList[i],enemyList[j]); //Check collision between enemy i and enemy j
}
}
What is different? this time, the inner loop i starts at j+1 instead of 0. That means, if j is 10, i will start at 11. This way, enemies will only check collision against enemies later in the list, never earlier, avoiding the double collision.
I usually try to loop from end to beginning, it’s a bit faster and usually can be the solution for lots of problems.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Collision detection fail
Originally posted by aenil333:
But what if i create one big movieclip with all my little blocking movieclip, could i hittest with only 1 object instead of 127 ? Or thats not possible to do such thing
Yeah it would, but don’t. You asked for advice and I gave you some, so listen. Also, you act like 3k is a lot, that’s almost nothing.
EDIT: I also forgot to mention don’t use built in hitTest functions to check if it’s intersecting, use the math, just find what tile it would be at with (x – x % TileWidth)/tileWidth
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Collision detection fail
Originally posted by aenil333:
You kinda lost me there…
. I seriously don’t think I can put that in simpler terms, but I’ll try:
Every Frame:
1) Find the bottom of the player with player.y + player.height, save this to a point.
2) Add velocity to that point. So if your player is moving 2px downwards do (playerXPos, playerYPos) + (0, 2)
3) Check if this is intersecting a tile (assuming you are using tile-based)
4) If it is, place it on top of the tile and set velocity to (whatever, 0)
Edit: You should really focus on cloning simpler games and learning more about optimization before making a platformer. In that code alone I can spot at least 5 things that would either slow down your code, or are un-necessary. For example:
1. double return false at the end
2. 2D arrays, this means you’re accessing through two arrays, so making 2x as many search calls
3. 4 for loops. Why not just one with the logic in it?
4. Don’t instantiate a new variables every frame. I see 4 alone. instantiate it once then change the value every frame.
5. Won’t slow down your code but your variable names are bad.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Deeper Topic (part 3): Events to the rescue!
Originally posted by jerimo:
Just a small question here, as to collisions in such a system, How in the world; Normally you go down the list of all things you need to check for collision, and the such, and you make sure to check each possibility only once, in such a system though I seem to not wrap my mind around the fact that without keeping a list of all objects it was checked against it would make every possible check twice, once for both of the objects? ((Objects used very wildly in this context I know, but for simplicity I went along with it))
On a side note, while answering, stay in pseudo code if you are to make some, as AS3 code takes me twice as long to work from, considering I do not use the said language, thanks
Edit: Considering Solsund’s post; I would get lost in rewriting every piece of code again and again; reworking the hierarchy, it becomes annoying quite fast, i must agree!
He should stick to AS3 as it’s what everyone here is using- the concept is the same. To be honest, it’s a lost cause trying to optimize AS2 with this system.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Collision detection fail
Originally posted by aenil333:
Ok i was trying to do a collision detection system for my character and enemy and came up with this too many for loop, which is looping trough too many tile to check if there is collision, so my game is kinda semi freezing.
I have a hundred square 64×64 pixel which go around my map and inside, every tile made this way is called world object. which is in a objectArray. What i want to do to reduce my lag, and i dont know if its possible, is take all those object (which are movieclips) and make one big one. How could i get this done? copypixel? Im not sure how to do this if anyone ever did this please tell me how to proceed1
OF course you’re lagging. Hit-testing that many tiles against your player is going to lag. Just do some math. Find out where the bottom of the player is, add it’s current velocity. Then check if that point (tile) is solid. If it is, set the velocity to 0 and then correct it.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Game Demo, and a question.
Interesting little game, good potential, but needs to be worked on way more:
1) P to unpause also.
2) Make it so you can’t move your aim when paused.
3) Make shooting/killing instantaneous, I shouldn’t have to wait to see that I hit the target. You can do this by plotting a line in the direction you shot and then check points along the line.
As imp2 said your difficulty should go up. Preferably it should start out easy, then fluctuate to and from easy and hard, so give the player a sense of accomplishment and progress.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Payment
Originally posted by EsCaPeThEfAtE2:
…
The email it was “sent” to was NEVER A PAYPAL EMAIL, I didnt know what paypal was at the time I entered the email.
AFAIK You can’t do anything to fix that, and it’s kind of your fault.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Top down scrolling movement
Originally posted by GameBuilder15:
Stickman, I see what you’re saying. Good idea. I’ll have to try that.
RTL, I can’t tell if you’re serious or not.
I’m completely serious. If you know how to make games in the sense, it’s a great tool. Just bad for people who haven’t programmed before.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Top down scrolling movement
Originally posted by GameBuilder15:
Okay, thanks guys. I’ll look have to look into this.
To be honest, the game I’m working at the moment is AS2, because I just felt like making a game today, and I don’t have enough knowledge to do it in AS3. AS2 seems really messy to me now, but I just felt like making a game because I really enjoy it. My programming is improving, even in AS2. For example, I almost copy/pasted the same line of code over and over to make a weapon particle effect, but then I remembered to use a for loop. Pretty embarrassing, but that’s the first time I’ve ever used a for loop. And it allowed me to easily make the particle effect reflect the weapon’s damage. The higher the damage, the more particles. (It’s a charging weapon, the player holds down the mouse to charge and releases it to fire.)
Once my AS3 books arrive, I should start making some serious progress.
You should check into Stencyl, I’m having fun playing with it.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Top down scrolling movement
Originally posted by GameBuilder15:
Thanks. But I don’t have a camera class. Are you talking about a Vcam?
1. Never use Vcams, they redraw the entire stage and are very intensive. They suck.
2. There is no default camera class in Flash, so I suggest you read into Blitting and then just offset all your rendering like so:
render(entity, entity.x + camera.x, entity.y + camera.y);
Where the first parameter is the entity to draw, and the second two are where to draw it.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
Where is the API?
Originally posted by imp2:
ugh, so there’s no library and no code hinting. I guess I’ll be reading the API Doc for the next 2 days. Thanks for the speedy answer :).
It would maybe take an hour to get it working for someone with no experience in it- it shouldn’t take 2 days.
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
AS3 tutorials
Originally posted by NineFiveThree:
Originally posted by feartehstickman:
This website has some step-by-step tutorials.
private var _root:MovieClip;
//...
_root = MovieClip(root);
step by step in the wrong direction
Wow. Did he seriously just do that to have similar syntax to AS2’s _root?
|
|
|
RTL_Shadow
1023 posts
|
Topic: Game Programming /
expecting rightbrace
Originally posted by AlexanderC4:
Sorry I just find it really confusing. I just changed it and it worked but I now have the following error
C:\Users\Alex The Best\Desktop\Golden Catch\Classes\GoldBar.as, Line 12 1046: Type was not found or was not a compile-time constant: TimerEvent.
1. We don’t have the code to that class.
2. It’s pretty obvious what’s happening in that error, can’t you do at least a little research before asking others?
|