Jump to content
  • Advertisement

tashaklikedi

Member
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

226 Neutral

About tashaklikedi

  • Rank
    Member
  1. thanks for the replies! Tchom: it says that the mDisplayBD member of the Render class is null 
  2. oh damn I'll edit this post because obviously I made a lot of errors trying to make it more understandable. The actual name of the Entity class is BAUBackground actually, but for understandability reasons I changed it to Entity. Let me edit   There is no error it just does not render :)
  3. Hello all, I need help with some calling issues. I am trying to create a game engine for my future games in actionscript 3, and I am working on a method called Renderer, which I plan to add as member to all my classes which will be displayed on the screen. I use blitting method. I have a GameLoop method, which is in the Game class, and an Entity class, which incorporates an instance of the Renderer class.   I'll try to give examples with code:   ** EDITED CODE ** //Game.as: package { //import things public class Game extends Sprite { var mDisplay:Bitmap; var mDisplayBD:BitmapData; var mEntity:Entity; public function Game() { //initialize things mDisplayBD = new BitmapData(Constants.SCREEN_WIDTH,Constants.SCREEN_HEIGHT,false,0x000000); mDisplay = new Bitmap(mDisplayBD); mEntity = new Entity(mDisplayBD); this.addEventListener(Event.ENTER_FRAME,GameLoop); this.addChild(mDisplay); } public function GameLoop(e:Event) { mEntity.Render(); } } } //Renderer.as package { //import stuff public class Renderer { var mBitmapData:BitmapData; var mPoint:Point ; var mRect:Rectangle ; var mDisplayBD:BitmapData; public function Renderer(bitmapdata) { mBitmapData = bitmapdata; this.mDisplayBD = bitmapdata; mPoint = new Point(); mRect = new Rectangle(); mPoint.x = 0; mPoint.y = 0; } public function LoadBitmap(URL:String) { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, OnComplete); loader.load(new URLRequest(URL)); } private function OnComplete(event:Event) { mBitmapData = event.target.content.bitmapData; } public function Render(posX,posY,clipX,clipY,width,height) { mDisplayBD.lock(); mPoint.x = posX; mPoint.y = posY; mRect.x = clipX; mRect.y = clipY; mRect.width = width; mRect.height = height; mDisplayBD.copyPixels(mBitmapData,mRect,mPoint); mDisplayBD.unlock(); } } } //Entitiy.as package { //import public class Entity extends Sprite { var mPosX; var mPosY; var renderer:Renderer; var input:InputManager; var mDisplayBD:BitmapData; public function Entity (bitmapdata:BitmapData) { mDisplayBD = bitmapdata renderer = new Renderer(mDisplayBD); renderer.LoadBitmap("filename.png"); } public function Render() { renderer.Render(mPosX,mPosY,0,0,Constants.SCREEN_WIDTH,Constants.SCREEN_HEIGHT); } } }    When I create a new renderer instance in the class game, and do something like renderer.Render() in the GameLoop method, it works, but not when I do it as entity.renderer.Render();   I have to solve this until tomorrow, please can anyone help me? I searched a lot on the internet, but found nothing... (maybe I dont know what to look for).   Edit: dont mind the var input:InputManager; line, I forgot to remove it from the sample code
  4. I found the problem: there is a bitwise flag that does not work in the actual exe:   it goes like:    if(CEntityManager::currentMapEntities->flags & ENTITY_GAIA)    this condition is always negative in the original exe, but it works in debug mode. Why could this happen?
  5. I tried 1- and it didn't work. the weird thing is, there is a defaults.sav file which holds all the default settings, which includes an entity which is an electric wire, which is supposed to be a solid body. It loads its sprite as it should, but it does not load its collisions... from the same file
  6. Hello everyone, I have a strange issue ( noob programmer here ) Some of my game's collisions do not work when I click on the exe that is located in the "release" folder from windows explorer, but they work when I do "build and compile" from visual c++. I made sure I compiled in release mode, and the data folder is copy paste in both folders.  I really don't understand. 
  7. several years ago, I had a great game idea. I had a friend who knew how to program in C++, so we started doing it. I did the art, and the music, even if I'm not that great at drawing. But my friend gave up after making the character walk. So a year ago, I decided I would not give up on my project, and started to learn C++. Right now I can get what I want to work in a 2d environment, as long as it is not over complicated. Now a guy with experience would say that my code sucks, and it does, but I dont care that much as long as my game works.    If you really want to develop games, you can. There are a lot of great tutorials on the net, and tools to create games today are awesome. Once you get into it, its great fun, and I can say that its addicting.
  8. tashaklikedi

    How to handle states in a fighting game?

    oh great are you going to do it in 3D?
  9. tashaklikedi

    How to handle states in a fighting game?

      I have my own sprite sheets ^^ I do the art myself for now. I'll transform the ideas above to code and tell you guys if it works^^
  10. tashaklikedi

    How to handle states in a fighting game?

    I forgot direction and type enums: /* the direction enum reads from another secondary buffer which is relative to the direction the user's facing. i.e. left = forward if the user is facing left*/ enum direction { up down forward back } //this is simply to know what kind of attack it is enum type: { hit grab projectile etc... } enum type: { hit grab projectile etc... }
  11. tashaklikedi

    How to handle states in a fighting game?

    Hello again, after all this discussion, I thought about how I can implement a combo system that could be unique for each character. I came up with something like this:   //PSEUDOCODE: class attack: { enum type enum stance //the game will have a lot of stances, this includes running while grabbing a guy, or different weapon styles, figting styles etc.. std::string name //each attack should have a name for the sake of clarity int ID //to be inserted in a vector unsigned int animationID //which animation will be played? std::vector<std::string> vCanComboTo //to which moves it can be comboed to? gameInput inputList[5] /*what input will be querried to the move to be executed? this will be read from a buffer of enums, which will go like below.*/ } //the gameInput struct covers all kinds of commands that can be input to the game. struct gameInput: { enum button enum direction bool bModifier } /*the button enum reads from a secondary buffer, that only records the 3 attack buttons and combinations like "HCF" which means half circle forward ( a street fighter style input)*/ enum button { punch kick grab HCF HCB QCF QCB }     what do you think?
  12. tashaklikedi

    What makes a good beat'em up game?

      I am also trying to develop a beat em up. I think a beat em up is played best with a gamepad. So I use a ps3 style gamepad layout:   D-pad to move square  => punch x            =>kick o           => jump triangle => grab R1        => block  R2        => attack modifier (l1 + punch will result in a different attack from punch only) L1        => use  L2        => inventory (think of use and inventory like in castle crashers)
  13. tashaklikedi

    How to handle states in a fighting game?

    I like the frame class idea^^  Thanks for the long replies and for your effort! I'll try to implement all these things (gonna take me a lot of time since I think I'm gonna reprogram the game from scratch) and let  you know if I succeed^^
  14. tashaklikedi

    How to handle states in a fighting game?

    And what about inputs? Right now, my input function has control over states. For example, when I press punch, it verifies the state I'm in, and if its allowed to do so, it transitions into a new state.   With your system I can think of a solution like this: When I press an attack button (there are a punch, a kick, a grab, and an attack modifier button, and I plan on adding shoryuuken style special inputs), I change state to attack, And then logic in the attack case in the state function will deal with its type.   Am I getting it right?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!