Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | List to not walk into walls. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | bc575faeae713ae19905d5e84c32c962c1f0343f |
User & Date: | gerald 2013-08-16 22:01:46 |
Context
2013-09-12
| ||
19:52 | Added header comments. check-in: 0fa2e7a927 user: gerald tags: trunk | |
2013-08-16
| ||
22:01 | List to not walk into walls. check-in: bc575faeae user: gerald tags: trunk | |
21:41 | Game now feature complete!! check-in: 11179945c5 user: gerald tags: trunk | |
Changes
Changes to lib/simulation.tcl.
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
set holeList [$c find withtag hole]
set maxHole [llength $holeList]
set hole [lindex $holeList [::math::random 0 $maxHole]]
set popOut [split [dict get [getItemDict $hole] popOut] {,}]
$c coords player {*}$popOut
unset calculated(inTunnels)
}
} elseif {[llength [$c find withtag target]]} {
set playerCoords [$c coords player]
set vector [concat $playerCoords [$c coords target]]
set angle [::math::geometry::angle $vector]
set playerCoords [::math::geometry::movePointInDirection $playerCoords $angle $calculated(distancePerStep)]
$c coords player {*}$playerCoords
}
................................................................................
} elseif {[dict exists $overlapList charged]} {
return -code error [::msgcat::mc DeathByElectrocution]
} elseif {[dict exists $overlapList hole]} {
set calculated(lastPosition) [$c coords player]
set calculated(inTunnels) [::math::random $settings(RefreshRate) [expr {5 * $settings(RefreshRate)}]]
$c coords player -5000 -5000
catch {$c delete target}
}
}
proc moveRobots {} {
variable settings
variable calculated
variable ::gui::windows
|
>
>
>
>
>
>
>
>
>
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
set holeList [$c find withtag hole] set maxHole [llength $holeList] set hole [lindex $holeList [::math::random 0 $maxHole]] set popOut [split [dict get [getItemDict $hole] popOut] {,}] $c coords player {*}$popOut unset calculated(inTunnels) } return; } elseif {[llength [$c find withtag target]]} { set playerCoords [$c coords player] set vector [concat $playerCoords [$c coords target]] set angle [::math::geometry::angle $vector] set playerCoords [::math::geometry::movePointInDirection $playerCoords $angle $calculated(distancePerStep)] $c coords player {*}$playerCoords } ................................................................................ } elseif {[dict exists $overlapList charged]} { return -code error [::msgcat::mc DeathByElectrocution] } elseif {[dict exists $overlapList hole]} { set calculated(lastPosition) [$c coords player] set calculated(inTunnels) [::math::random $settings(RefreshRate) [expr {5 * $settings(RefreshRate)}]] $c coords player -5000 -5000 catch {$c delete target} } else { ## ## Make sure we are not running into a wall ## lassign [$c coords player] x y $c coords player \ [::tcl::mathfunc::max [::tcl::mathfunc::min $x 600] 40] \ [::tcl::mathfunc::max [::tcl::mathfunc::min $y 600] 40] } } proc moveRobots {} { variable settings variable calculated variable ::gui::windows |