Recent posts by PixelSingularity on Kongregate

Flag Post

Topic: Game Programming / Transitioning to blitting: MouseEvents and Collision detection issues

@ Bob – Since all the objects that I have displayed are blitted to my canvas, how would I store their information in the ‘parent’? Wouldn’t they essentially be orphans? I mean I am not calling addChild on them at any point.

@ Drakim – In your solution are you is collision tester its own class or is that a method of any collidable object? If it is wouldn’t that introduce interdependence between every single object? Such as the need for everyone to check against every other one every frame?

 
Flag Post

Topic: Game Programming / Transitioning to blitting: MouseEvents and Collision detection issues

My graphics are separate from my logic, that is where the issue comes from. I am used to using graphic objects as concrete entities to preform logic on, this is my first attempt to abstract the physical properties of them and I am a bit lost.

 
Flag Post

Topic: Game Programming / Transitioning to blitting: MouseEvents and Collision detection issues

Hello,

I have started to learn how blit in an effort to make the type of games I want, mainly ones with a lot of projectiles/units. I have been using this 3 part video tutorial:

http://gotoandlearn.com/play.php?id=140

I can blit now IE: render my bitmaps to the screen using a single bitmap and copyPixels(). But I have run into a few issues of things that I take for granted when using displayObject:

MouseEvents
Collision

I have created a simple tile map for a rudimentary TD (To learn concepts only, no one needs me to release another generic TD) using 2 tiles I have created one that will be a path and is used for units to travel on and the other will be non pathable ground that will be buildable; pretty standard stuff. So the first issue is simple, I want to click on a buildable tile to create a tower. The problem is, bitmaps can’t handle mouseEvents. FRom what I have read this leaves me with 2 possible solutions. Solution:

1) Wrap my bitmap objects in sprites – This solution seems to defeat the entire purpose of blitting. If I am going to wrap my bitmap in a sprite I might as well just use a sprit in the first place as I will have all the overhead I was looking to avoid.

2) Math – Attach an event listener to the main class (extends sprite) and use math to determine which tile I am clicking on. I am unsure of how to do this. The thought I have on doing this right now is that I pass the coordinates of the mouseclick to an event that checks the the coords against an array ot tiles. My tiles have x and y properties and width and height so I should be able to determine which tile I am clicking on. This could also get pretty intensive on maps with a lot of tiles. Any thoughts on this would be great.

The next issue is collision detection. I have no idea how to go about this with bitmapData. I am just getting past using hittest (A sin, I know) and am not sure how to go about implementing a simple system. Am I supposed to check actual pixels for overlap or am I supposed to define a geometric shape in my classes that I use to test for overlap based on the position of the bitmapdata render?
 
Flag Post

Topic: Game Programming / Text, Strokes, Glows, and Lag

Wish I could help, but I can’t. Just wanted to say that I love the style! and I am looking to do something like this and will be watching for the solution :)

 
Flag Post

Topic: Game Programming / Game effect architecture

Main game loop iterates through projectile list, checks to see if the line formed from the projectiles previous position and new position passes through an enemy, if the true the enemy is dealt damage based on the weapons min – max damage.

 
Flag Post

Topic: Game Programming / Game effect architecture

Hello,

I am making an effect similar to the damage over time elemental effect in borderlands. I can accomplish the effect, my question is how you would accomplish it. I am not asking anyone to write the code or classes for me, just asking how some of the more experienced programmers would construct it, my thoughts so far:

Gameloop: I could simply put a boolean flag that if true registers the damage per every couple of frames. Simply but very limited and given that I plan a few different damage types could get convoluted quickly.

Gun Class: I could have the gun have the information about the element type and the damage, and even the function. flagging an effected unit, but this still leaves the actual damage dealing and registering portion in the gameloop when I iterate through the enemies.

I could even make the elemental damage over time effect its own class, but again the only way I can think of actually executing the function is with a flag in my main enemy iteration loop :(. I was hoping for something that didnt rely on a conditional statement in my main loop, but that is what I keep coming back to. Thoughts?

 
Flag Post

Topic: Game Programming / Indie Goodbye

Originally posted by BraydenBlack:

Why does this have to be on my birthday :(

You are the Mayan Devil. Simple.

 
Flag Post

Topic: Game Programming / Stopping Starting sound with soundchannels(solved) (finally)

assuming that bgmusic is linked correctly, this should work:


package 
{
	import flash.media.Sound;
	import flash.media.SoundChannel;
	import flash.events.MouseEvent;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.ui.Keyboard;
	public class soundButton extends MovieClip
	{
		
	
		
		var bgChannel:SoundChannel = new SoundChannel();
		var bgm:Sound = new bgmusic()  ;
		
		var mreleased:Boolean = false;
		var mute1:Boolean = true;
		
		
		function soundButton()
		{

			
			
			bgChannel = sound.play();
			addEventListener(Event.ENTER_FRAME, soundcontrol);


		}
		
		function soundcontrol(e:Event)
		{

			if (Key.isDown(77))
			{
				if (mreleased)
				{
					togglemusic();
					mute1 = ! mute1;
					this.nextFrame();
				}
				mreleased = false;
			}
			else
			{
				mreleased = true;

			}
		}
		
		
		function togglemusic()
		{
			if (mute1 == true)
			{
				trace("muted");
				bgChannel.stop();//TypeError: Error #1009: Cannot access a property or method of a null object reference.
			}
			else
			{
				trace("unmuted");
				
				
				bgChannel = sound.play();
			}
		}
	}

}

Wrong about the accessibility of variables declared in the constructor functions. They are function variables ONLY. They exist while that function is being run, as soon as your class is constructed it no longer has a reference to bgChannel unless it is declared OUTSIDE of the function, after your class declaration. Variables declared here are class variables and are accessible to all functions within this class. Hope this helps.

 
Flag Post

Topic: Game Programming / Stopping Starting sound with soundchannels(solved) (finally)

You have a scope issue. You need to declare bgChannel OUTSIDE of your functions so it exists to be referenced by your functions:


public class soundButton extends MovieClip
	{
		var mreleased:Boolean = false;
		var mute1:Boolean = true;
                ______________________________  < ---- here


		function soundButton()
		{