Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4626726
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:27:46+00:00 2026-05-22T03:27:46+00:00

Player.m // // PlayerTestAppDelegate.m // PlayerTest // // Created by Someguy on 5/13/11. //

  • 0

Player.m

//
//  PlayerTestAppDelegate.m
//  PlayerTest
//
//  Created by Someguy on 5/13/11.
//  Copyright 2011 Enginering. All rights reserved.
//

#import "Player.h"

@implementation Player
@synthesize window;

//[NSThread sleepForTimeInterval:.1];

// On the program finished loading, do the following..
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {plyr_size = 10; xcord = 200; ycord = 215; [self DrawPlayer];}


- (void)Clearscreen{NSPoint origin = {0,0}; NSRect rect; rect.origin = origin; rect.size.width=1000; rect.size.height=1000; NSBezierPath * path; path = [NSBezierPath bezierPathWithRect:rect]; [path setLineWidth:4]; [[NSColor whiteColor] set]; [path fill]; [[NSColor whiteColor] set]; [path stroke];} 

- (void)DrawPlayer{[self Clearscreen]; NSBezierPath * path = [NSBezierPath bezierPath]; [path setLineWidth:4]; NSPoint center = {ycord,xcord}; [path moveToPoint: center]; [path appendBezierPathWithArcWithCenter: center radius: plyr_size startAngle: 0 endAngle: 360]; [[NSColor grayColor] set]; [path fill]; [[NSColor grayColor] set]; [path stroke];}



//Declare these actions

- (IBAction)PlayerMoveForward:(id)sender {[self PlayerMoveForward];}
- (IBAction)PlayerMoveBackwards:(id)sender {[self PlayerMoveBackwards];}
- (IBAction)PlayerMoveLeft:(id)sender {[self PlayerMoveLeft];}
- (IBAction)PlayerMoveRight:(id)sender {[self PlayerMoveRight];}

// Declare the Methods used for movement

- (void)PlayerMoveForward {xcord=xcord+10; [self DrawPlayer]; [self GetPlayerPostion];}

- (void)PlayerMoveBackwards {xcord=xcord-10; [self DrawPlayer]; [self GetPlayerPostion];}

- (void)PlayerMoveLeft {ycord=ycord-10; [self DrawPlayer]; [self GetPlayerPostion];}

- (void)PlayerMoveRight {ycord=ycord+10; [self DrawPlayer]; [self GetPlayerPostion];}

- (void)GetPlayerPostion {NSLog(@"Player cordinates (%i, %i)",xcord, ycord);}

@end

EntityZombie.m

//
//  EntityZombie.m
//  PlayerTest
//
//  Created by Someguy on 5/13/11.
//  Copyright 2011 Enginering. All rights reserved.
//

#import "EntityZombie.h"
#import "Player.h"

@implementation EntityZombie : Player

//- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {[self FollowPlayer];}
- (void)awakeFromNib{[self FollowPlayer];}

- (void)DrawZombie {if ([self CanSpawnZombie] == TRUE){NSBezierPath * path = [NSBezierPath bezierPath]; [path setLineWidth:4]; NSPoint center = {215,200}; [path moveToPoint: center]; [path appendBezierPathWithArcWithCenter: center radius: 18 startAngle: 0 endAngle: 360]; [[NSColor greenColor] set]; [path fill]; [[NSColor greenColor] set]; [path stroke];}}
- (void)FollowPlayer {
    NSLog(@"Zombie is following player..");
    //zombie_xcord == xcord-1;
    //zombie_ycord == ycord-1;
    [self DrawZombie];
}

- (BOOL)CanSpawnZombie{return TRUE;}

@end

The zombie will not render and I have the log of

2011-05-13 20:59:22.677 PlayerTest[45207:a0f] Zombie is following player..
Fri May 13 20:59:22 Someguy-MacBook-Pro.local PlayerTest[45207] <Error>: CGContextSetFillColorWithColor: invalid context 0x0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:27:46+00:00Added an answer on May 22, 2026 at 3:27 am

    There is no current draw context. The issue is from where you are calling the draw methods. They need to be called from a -(void) drawRect method or, if you’d prefer, you can draw into an image. Either way, there has to be a current draw context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a flash player that pops out into a separate popup browser window. And
I have created Player object as player = Manager.createPlayer(inputStream,audio/mpeg); and plays the audio as
i created a music player with previous and next functionality in my app.i want
A player: http://www.yvoschaap.com/videowall/ How can you customise the above Chromeless Youtube to have Play/Stop/Pause
Flash Player 10 specifies: Redirects to policy files outside the originally requested domain will
for (Player p : players) { p.addCard(deck.dealCard()); p.addCard(deck.dealCard()); } and for (int i =
For parsing player commands, I've most often used the split method to split a
I have a flash player that has a set of songs loaded via an
When I run player.php it's giving this error: Warning: Cannot modify header information -
I am using JW Player in an ASP.NET MVC application and I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.