Results 1 to 3 of 3

Thread: Testing C++ highlighting

  1. #1

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Testing C++ highlighting

    Code:
    #include "mage.h"
    #include "fireball.h"
    #include "level.h"
    
    Mage::Mage(Level *l, DrawEngine *de, int s_index, float x, float y, int lives) 
    				: Character(l, de, s_index, x, y, lives)
    {
    	classID = MAGE_CLASSID;	
    }
    
    bool Mage::keyPress(char c)
    {
    	bool val = Character::keyPress(c);
    	
    	if (val == false)
    	{
    		if (c == keys.attack)
    		{
    			castSpell();
    			return true;
    		}
    	}
    	return false;
    }
    
    void Mage::castSpell(void)
    {
    
    	if (isValidMove((int)pos.x + facing.x, (int)pos.y + facing.y))
    	{
    		Fireball *temp = new Fireball(lvl, dengine, SPRITE_FIREBALL, (int)pos.x + facing.x, 
    			(int)pos.y + facing.y, facing.x, facing.y);
    	
    		lvl->addNPC((Sprite *)temp);
    	}
    }
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: Testing C++ highlighting

    Originally posted by Cander
    Code:
    #include "mage.h"
    #include "fireball.h"
    #include "level.h"
    
    Mage::Mage(Level *l, DrawEngine *de, int s_index, float x, float y, int lives) 
    				: Character(l, de, s_index, x, y, lives)
    {
    	classID = MAGE_CLASSID;	
    }
    
    bool Mage::keyPress(char c)
    {
    	bool val = Character::keyPress(c);
    	
    	if (val == false)
    	{
    		if (c == keys.attack)
    		{
    			castSpell();
    			return true;
    		}
    	}
    	return false;
    }
    
    void Mage::castSpell(void)
    {
    
    	if (isValidMove((int)pos.x + facing.x, (int)pos.y + facing.y))
    	{
    		Fireball *temp = new Fireball(lvl, dengine, SPRITE_FIREBALL, (int)pos.x + facing.x, 
    			(int)pos.y + facing.y, facing.x, facing.y);
    	
    		lvl->addNPC((Sprite *)temp);
    	}
    }
    hehe cool, mind wont take much code to fill up the limit .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    True. But in most case if someone is posting a bit of code, they are posting a protion of it. Otherwise they casn split it up.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width