Recent posts by Pixel_Chaos on Kongregate

Flag Post

Topic: Game Programming / Bliting, best practises

Hello,

I am creating my first bliting engine. I can blit my bitmaps but I am not sure about the best way to set things up. I have to CopyPixels() for all my graphic objects to my canvas Bitmap, but I am not sure what the best way to do this is. Do I keep an array of all my Bitmap objects and iterate them like I would Sprites or movieClips? If so then I need several arrays, an array for each type of object I am displaying and a master array that holds all the arrays? If someone wants to point me in the right, or at least a good direction, I would appreciate it.
 
Flag Post

Topic: Game Programming / AddChild relative positioning

Thank you to all that responded. The problem was just as listed, I didn’t give the parent any coords so the child spawned at 0,0. My problem was a misunderstanding of the way drawRect() works. I had thought that since the arguments define it’s location that they were its actual position coordinates. I will be reading the Reference docs before my next question. Thanks again!

 
Flag Post

Topic: Game Programming / Debugging

Hello,

Firstly please use the tags listed in the “How to format” sticky in this forum.

Secondly and in regards to your error, have you created a gameScore and a gameClock symbol and exported them for use with actionscript with those names?

 
Flag Post

Topic: Game Programming / AddChild relative positioning

Hello,

I have 2 classes the first of which is my document class that creates a stage sprite that I add an instance of my second class to. My second class is a sprite that contains a shape and a textfield. I am trying to add the textfield as a child of the shape and I can get it to display, but its position is set relative to my stage sprite, which it is a grandchild of, not my menuPanel instance, which it is the child of. According to my searching and the tutorial I am working off of, positioning of addChild is supposed to be relative to the parent. Is this not correct?

Code below:

package  {
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import flash.display.Sprite;
	
	public class Game extends MovieClip {

		private var iPanel:ExpositionPanel = new ExpositionPanel();
		private var iStage:Sprite = new Sprite();
		
		
		public function Game(){
			
			trace("Program started");
			initialize();
			
		}
		
		public function initialize():void{
			
			trace("Program initializing...");
			
			trace("Creating iStage Sprite...");
			iStage.graphics.beginFill(0xFFCC00);
			iStage.graphics.drawRect(0, 0, 700,700);
			iStage.buttonMode = true;
			
			
			trace("Adding Stage sprite...");
			addChild(iStage);
			
			iStage.addEventListener(MouseEvent.CLICK,clicked);
			
			trace("adding Exposition Panel...");
			addChild(iPanel);
			
			trace("Adding mouse event listener...");
			
			
			
		}
		
		private function clicked(evt:Event):void{
			
			trace("Click registered");
			
		}

	}
	
}

package  {
	
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFieldAutoSize;
	import flash.text.AntiAliasType;
	
	public class ExpositionPanel extends Sprite {
		
		private var panelText:TextField = new TextField();
		private var menuPanel:Sprite = new Sprite();

		public function ExpositionPanel() {
			
			
			menuPanel.graphics.beginFill(0xFF00FF);
			menuPanel.graphics.drawRect(0,200,550,300);
			menuPanel.graphics.endFill();
			addChild(menuPanel);
			
			
			panelText.text = "Initialized";
			menuPanel.addChild(panelText);
			panelText.x = 20;
			panelText.y = 20;
			
			
		}

	}
	
}


 
Flag Post

Topic: Game Programming / Custom debug panel display

@DRaco18s – That was what I was thinking/reading. Not sure exactly how I would implement such a thing. I can make very simple games (Pong) but I am not too clear on how something like that would even go. Would I have to have 2 copies of each of the variables, one real and one abstraction that existed only to gain a permanent reference to?

@NineFiveThree – Because in more than a few tutorials and proof of concepts I have read/tried, I have seen basically what I described, allowing the user a better understanding of what was happening behind the scenes in the program or app in real time. I figured making something to that effect myself would increase my understanding of the language, a goal in itself. Also it would allow me better real time debugging for the problems I am sure to run into during the process of making games.

 
Flag Post

Topic: Game Programming / Custom debug panel display

Hello,

I am trying to make what I thought would be a relatively simple custom debug panel. My goal is to have a panel that tracks any variables that I pass it dynamically. After searching on google it seems what I am looking for is pass by reference, which Actionscript does not support. Is there a way to have a class that I pass whatever variables I want tracked into and have it DYNAMICALLY track and display those variables? I can pass and display a variable easy enough, but I don’t want to call a function to update the state of that variable every frame if I can help it. THat seems like needless overhead and like it would end up with really cluttered code. Any thoughts?