Jump to content
  • Advertisement

tashaklikedi

Member
  • Content Count

    34
  • Joined

  • Last visited

Everything posted by tashaklikedi

  1. 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
  2. thanks for the replies! Tchom: it says that the mDisplayBD member of the Render class is null 
  3. 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 :)
  4. 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. 
  5. 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?
  6. 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
  7. Hi everyone, as a newbie programmer, I am trying to develop a 2D side scrolling Streets of Rage like fighting game with a lot of characters, moves, and animations. I started to learn programming 1 year ago, and I managed to have a game where I have two player controllable characters hit each other, jump to higher elevations in a streets of rage style map, etc...   However, since I am new to programming, and rushed enthusiastically into programming the game without any plan, my code got really messy.  My problem is how to handle character states ( or moves ) , and their animation...   How I proceeded is: I have a huge switch function with states, another one with animations, another one with hitboxes for example:   //this is the base punch for the ninja character. // this is the state switch function case NINJA_BASEPUNCH: falsify(); // set everything to false (i.e. he cant jump while punch animation is on) bCanBasePunch = true; enumAnimState = NINJA_AS_BASEPUNCH; //animation is set to base punch animation enumHitMessage = HIT_LIGHT_HI; //this will tell the enemy entity the damage type ( light ) and its position ( high ) basePunch(); //punch function break; //once this is executed, the program will set the animation settings //this is from animation switch function case NINJA_AS_BASEPUNCH: sprite.w = 36; sprite.h = 36; iCurrentFrameCol = (bFaceRight ? 13:14); iCurrentFrameRow = 0; animation.maxFrames = 2; animation.setFrameRate(animation.getCurrentFrame() > 0 ? 100:60); break; } //this is from the hitbox update function. case NINJA_AS_PUNCH: hitbox.w = groundPos.w; hitbox.h = 35;   All this is only for a simple basic punch. Now imagine how would it be if there was a big move list, big combos, stunts, etc... I need to get a better system for it, anyone who can think of a better implementation system?  
  8. 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.
  9. tashaklikedi

    How to handle states in a fighting game?

    oh great are you going to do it in 3D?
  10. 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^^
  11. 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... }
  12. 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?
  13. 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)
  14. 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^^
  15. 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?
  16. tashaklikedi

    How to handle states in a fighting game?

    Oh and by the way is it better to open and close the data file each time, or to open it once and close it when the program ends?
  17. tashaklikedi

    How to handle states in a fighting game?

    I already have a function like this but I assigned a state to each hit type ^^    but again there will be a lot of hit styles ( different animation for strong or light hits, a lot of death animations given the weapon / move)... Should I do it also with data?
  18. tashaklikedi

    What makes a good beat'em up game?

    Great post ^^ River City Ransom FTW!  All Kunio Kun games were awesome. This from the Kunio Kun series which includes River C?ty Ransom.  
  19. tashaklikedi

    How to handle states in a fighting game?

    Hey, that was a great reply and will be very helpful!! I think I grasped the logic, now I got to apply it to my system. thanks! I'm also gonna look at that thread   EDIT: Wow that was a great post!! the game I'm working on is actually directly influenced by River City Ransom (with unique characters and moves, the RPG elements, free world, etc). I was thinking of a mario style map like Scott Pilgrim, which looks also great.   Well I am a noob programmer, and I have a LOT to learn... But its so fun ^^
  20. tashaklikedi

    How to handle states in a fighting game?

    I don't know how to do that (I'll learn tho, I'm sure there is documentation about how its done), but each attack does not work the same way, especially input wise, some attack will combo with some, while they wont combo with others etc.. it sounds like a great solution tho..
  21. I know about SFML, I never tried it but I know that it has more features than SDL ( like sprite rotating). As for the sound I went for FMOD and it worked well ^^.
  22. Hi everyone, In the game I'm developping I'm trying to use nsf (nintendo sound format) files as music and waves as sound effects. The nsf library uses SDL_Sound. the problem is that I can never load two files simultaneously. The NSF library is not able to load two sounds at once, and when I try to load my wav files with SDL_Mixer, I can't play the NSF file. I was wondering if multi threading would solve this...
  23. ok I used wav's with SDL_mixer, but now I have a new problem: seamless looping... I need no glitches between audio files since some songs have to be in different audio files (for example 1 non looped intro than loop the rest).. I did a little research and found out that it is a problem of SDL_Mixer. Does anyone know other sound libraries that can solve this issue?
  24. ahah never thought it like that... thanks I'll try that
  • 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!