JamesObscura
250 posts
|
Topic: Game Programming /
Haxe questions
I’m an idiot. I didn’t think rectangles had an x/y coord in addition to their width/height.
Solved my problem. Thanks a ton Amibtious.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Haxe questions
Flag is set.
.draw works.
Works:
davetest.bitmapData = Assets.getBitmapData("assets/DaveHeadIdle.png");
var davetest2:Bitmap = new Bitmap();
davetest2.bitmapData = davetest.bitmapData;
addChild(davetest2);
Doesn’t work:
davetest.bitmapData = Assets.getBitmapData("assets/DaveHeadIdle.png");
var davetest2:Bitmap = new Bitmap();
davetest2.bitmapData = davetest.bitmapData;
davetest.bitmapData = new BitmapData(davetest.bitmapData.width, davetest.bitmapData.height);
davetest.bitmapData.copyPixels(davetest2.bitmapData, new Rectangle(davetest.bitmapData.width/2, davetest.bitmapData.height), new Point(0, 0));
addChild(davetest);
Also doesn’t work if I use constants instead of the width/height calls.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Haxe questions
The debug flag is being sent when I compile and it’s using the default flash debugger. I just can’t get it to actually do any debugging :\
Running process: D:\Haxe\Haxe\haxelib.exe run nme run "C:\Users\Obscura\Dropbox\TestProject\TestProject.nmml" flash -debug -DSWF_PLAYER="C:\Program Files (x86)\FlashDevelop\Tools\flexlibs\runtimes\player\11.1\win\FlashPlayerDebugger.exe"
The image is being embedded correctly. The first example works fine.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Haxe questions
Hey I’m finally working on a project again, I’m using haxe because I thought it would be interesting, but I’m having some really basic issues that I can’t seem to solve.
First off I can’t get debug to work at all. It just absolutely refuses to stop on breakpoints. I’m using FD for my IDE.
Secondly, I can’t get copypixels to work at all.
This works and displays my image:
var davetest:Bitmap = new Bitmap();
davetest.bitmapData = Assets.getBitmapData("assets/DaveHeadIdle.png");
addChild(davetest);
This gives me an empty bitmap:
var davetest:Bitmap = new Bitmap();
davetest.bitmapData = Assets.getBitmapData("assets/DaveHeadIdle.png");
var davetest2:Bitmap = new Bitmap();
davetest2.bitmapData = new BitmapData(davetest.bitmapData.width, davetest.bitmapData.height);
davetest2.bitmapData.copyPixels(davetest.bitmapData, new Rectangle(davetest.bitmapData.width, davetest.bitmapData.height), new Point());
addChild(davetest2);
Thank you in advance.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
How would you splice object?
Linked lists are awesome for entity storage. They have O(1) speed for adding/removal. They’re slower than arrays for random access though.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Using addchild to add the same movie clip twice
for (int i = 0; i < numBullets; i++){
if (i ! = 3)
addChild(new Bullet(x * i, y * i));
else
addChild(new Bullet(42, y * i));
}
If you want to do a lot of exceptions, try using a switch table.
Edit: In response to your post above, look up blitting. Using the displaylist is rather slow, you can get a significant performance boost with a good blitting engine implementation.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Originally posted by qwerber:
If you’d like to program in more english like code, you should try haskell, it’s quite interesting. Or better yet, stencyl blocks are even more intuitive. But honestly it’s just my habit of promoting faster ways because my projects take a tremendous computational cost to run.
Originally posted by qwerber:
Originally posted by JamesObscura:
Can you explain how you’d implement what you suggested without obfuscating your code?
if(shape.type == ShapeType.TRIANGLE)
{
//..rest
}
You see this method very often if you are an avid programmer. Flash libraries use a great deal of int flags and string flags. Although, an int flag is faster.
You did the same shit TWICE before I did. Troll harder kid.
It wasn’t a side topic. You attacked me over semantics. You derailed. You spammed.
You’re a spammer and a troll. You’re not even good at it.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Yeah. Because you’ve definitely responded to the OP in a constructive way in the majority of your posts. Uhuh.
Yeah. My post replying to the OP who was directly conversing with me is spam. Uhuh.
Not even trying with the trolling anymore. Oh well… Trolls gonna troll.
Edit: I just did a quick count. 3 constructive posts to 13 non-constructive posts. Now that’s spam.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
The massive amounts of off-topic spam, derailing, direct question dodging and over-all ineptitude gave the troll gag away. Unless you’re saying all that wasn’t you trolling and you just do that naturally? If so, my apologies.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Aggressive? Maybe you’re projecting. I was just telling you to troll another thread. You’re spamming this one with so much off topic crap its getting a bit silly.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
@AMD_Paulius_J:
Glad I could help. :)
@qwerber:
Are you actually implying that ‘is’ will slow down a program? Haha, you obviously haven’t done much programming.
Also haskell isn’t any more natural than AS3. You’d know that if you’d ever written in it I guess. Maybe you should try it out sometime? Functional languages are pretty cool for newbies.
Go troll somewhere else kid.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
@AMD_Paulius_J:
Try:
var realPoint:Point = new Point(0, 0);
@qwerber:
if(shape.type == ShapeType.TRIANGLE)
{
//..rest
}
Reads a lot worse than:
if(shape is Triangle){
// it literally reads like english.
}
But whatever dude. If you want to add a constant for every object for no particular reason, that’s cool. Don’t know why you’re all up in arms about it. Seems like an insignificant detail to me.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
So you’re adding a static variable and your flag to the shape class? That’s 2 levels of obfuscations using ‘is’ avoids. Just saying.
I’ve seen flags before. I haven’t seen redundant flags before.
I still don’t understand why you’d want to do that. It’s negligibly faster(if at all) and adds a layer of unnecessary complication.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Can you explain how you’d implement what you suggested without obfuscating your code?
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Why? It’s not slow. Using is also reads far better in my opinion.
Seems like a hassle to obfuscating your code for a solution that is negligibly faster.
If speed is so much of an issue, then he should just make an array for each object type.
Edit: @AMD_Paulius_J: It shouldn’t have to be in a loop. Try moving it to the fields section with your left and right points. Make sure to initialize it.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Building upon what feartehstickman said,
If you have a Triangle and a Cube class, you can just use the is keyword instead of adding a variable and checking that.
if(currentObj is Triangle){
//It's a triangle.
}
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
Why would you have 2 arrays? A single entity array is fine. You’re going to end up looping through it constantly anyways.
If you really wanted to group things up, you could make a container/group class(just a wrapper for an array), and throw that in your main entity array, then just delete containers whenever you wanted to delete groups. Doesn’t seem like an appropriate solution to such a simple problem though.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
You could loop through and just delete all the triangles.
Unless you have a LOT of objects, it wont hurt your performance.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Multiplayer kongregate
You have to have your own server, or some other service.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Enemy collision with a moving background
In Skull.as.
You can probably just convert the two point variables you make right after you make them. Just do something like:
leftBumpPoint = localToGlobal(leftBumpPoint);
Also you should try to move all code off the timeline.
|
|
|
JamesObscura
250 posts
|
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
New Programmer
Haxe is open sourced. If adobe decided to make people pay for the flash plugin, we’d all have no choice. But if haxe’s developer dies or something, the community just takes over.
Also being fluent in as3 is a joke. If you told a software programming job that you were fluent in AS3 they’d want to see advanced well designed, AIR apps. If you sent them your kong profile they’d probably laugh you out the door. Haxe isn’t much better in this regard, but it’s effectively a superset of flash, so it’s not like it could be worse.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
items loading queue class (AS3)
:|
It was a joke derail.
Please please please don’t derail this thread any further.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
items loading queue class (AS3)
Man if only there was a thread on the main page telling people not to be pretentious egotistical jerks and to not derail threads into shitty library vs writing your own method discussions.
Oh wait…
There is.
On that note Senekis you have very good points, but in my opinion, java is objectively the fastest programming language in the world.
@santaalex: Thanks for this post. Very good example code for some people and a fairly clean library class. I’ll see if I can come up with any changes.
|
|
|
JamesObscura
250 posts
|
Topic: Game Programming /
Stage..
Ok. I’m tired of being strawmaned. You’re right. Stage programming is far superior and actually makes you code faster and cleaner. It also makes you coffee.
|