60 |
_direction = direction; |
_direction = direction; |
61 |
} |
} |
62 |
|
|
|
[[NSNotificationCenter defaultCenter] |
|
|
postNotificationName:@"updateObject" object: [self game]]; |
|
|
|
|
63 |
return self; |
return self; |
64 |
} |
} |
65 |
|
|
73 |
|
|
74 |
/** |
/** |
75 |
* Change the mobile object velocity. |
* Change the mobile object velocity. |
76 |
|
* Post an notification named "updateObject" containing the current game and |
77 |
|
* the current object. |
78 |
*/ |
*/ |
79 |
- (void) setVelocity: (coord_t)velocity |
- (void) setVelocity: (coord_t)velocity |
80 |
{ |
{ |
81 |
_velocity = velocity; |
_velocity = velocity; |
82 |
|
|
83 |
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
84 |
|
object: [self game] |
85 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
86 |
|
forKey: @"HgObject"]]; |
87 |
} |
} |
88 |
|
|
89 |
/** |
/** |
96 |
|
|
97 |
/** |
/** |
98 |
* Change the mobile object direction. |
* Change the mobile object direction. |
99 |
|
* Post an notification named "updateObject" containing the current game and |
100 |
|
* the current object. |
101 |
*/ |
*/ |
102 |
- (void) setDirection: (float)direction |
- (void) setDirection: (float)direction |
103 |
{ |
{ |
104 |
[[NSNotificationCenter defaultCenter] |
_direction = direction; |
|
postNotificationName:@"updateObject" object: [self game]]; |
|
105 |
|
|
106 |
_direction = direction; |
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
107 |
|
object: [self game] |
108 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
109 |
|
forKey: @"HgObject"]]; |
110 |
} |
} |
111 |
|
|
112 |
/* |
/** |
113 |
* change the mobile object acceleration |
* Change the mobile object acceleration. |
114 |
|
* Post an notification named "updateObject" containing the current game and |
115 |
|
* the current object. |
116 |
*/ |
*/ |
117 |
- (void) setAcceleration: (float)acceleration |
- (void) setAcceleration: (float)acceleration |
118 |
{ |
{ |
|
[[NSNotificationCenter defaultCenter] |
|
|
postNotificationName:@"updateObject" object: [self game]]; |
|
|
|
|
119 |
_acceleration = acceleration; |
_acceleration = acceleration; |
120 |
|
|
121 |
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
122 |
|
object: [self game] |
123 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
124 |
|
forKey: @"HgObject"]]; |
125 |
} |
} |
126 |
|
|
127 |
/** |
/** |
140 |
|
|
141 |
/** |
/** |
142 |
* Change the mobile object maxSpeed. |
* Change the mobile object maxSpeed. |
143 |
|
* Post an notification named "updateObject" containing the current game and |
144 |
|
* the current object. |
145 |
*/ |
*/ |
146 |
- (void) setMaxSpeed: (unsigned)maxSpeed |
- (void) setMaxSpeed: (unsigned)maxSpeed |
147 |
{ |
{ |
148 |
[[NSNotificationCenter defaultCenter] |
_maxSpeed = maxSpeed; |
|
postNotificationName:@"updateObject" object: [self game]]; |
|
149 |
|
|
150 |
_maxSpeed = maxSpeed; |
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
151 |
|
object: [self game] |
152 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
153 |
|
forKey: @"HgObject"]]; |
154 |
} |
} |
155 |
|
|
156 |
/** |
/** |
157 |
* Change the mobile object maxAcceleration. |
* Change the mobile object maxAcceleration. |
158 |
|
* Post an notification named "updateObject" containing the current game and |
159 |
|
* the current object. |
160 |
*/ |
*/ |
161 |
- (void) setMaxAcceleration: (unsigned)maxAcceleration |
- (void) setMaxAcceleration: (unsigned)maxAcceleration |
162 |
{ |
{ |
163 |
[[NSNotificationCenter defaultCenter] |
_maxAcceleration = maxAcceleration; |
164 |
postNotificationName:@"updateObject" object: [self game]]; |
|
165 |
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
166 |
_maxAcceleration = maxAcceleration; |
object: [self game] |
167 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
168 |
|
forKey: @"HgObject"]]; |
169 |
} |
} |
170 |
|
|
171 |
@end |
@end |
173 |
@implementation HgMobile (NSCoding) |
@implementation HgMobile (NSCoding) |
174 |
|
|
175 |
/** |
/** |
176 |
* NSCoding method |
* NSCoding method to encode and decode objects |
|
* to encode and decode objects |
|
177 |
*/ |
*/ |
178 |
- (void)encodeWithCoder: (NSCoder *)encoder |
- (void)encodeWithCoder: (NSCoder *)encoder |
179 |
{ |
{ |