Solved how to make a batch movement simulator

November 1, 2013 at 08:36:33
Specs: Windows 7
ok so im making a game inspired by a zombie apocalypse where the character-@ wakes up in a hospital where the walls are-# and the door is-?...anyway I have no idea how to make a grid like so-
##########?###
#; !.......................#
#_!........................#
#..........................#
#...........................#
#..........................#
#._..................._# 
#[   ]................!$#  
#[@]................!$#
##############

I want to know how to make the character move through out the map but not be able to go through the "!" or the "#"... or the "_" near the money signs and the ";"...which would be items and a save place...gaahhh just imagine that wall on the right is straight! the font is different on the edit screen and the post screen

edited by moderator: Added pre tags, but it still don't look right. -Razor2.3


See More: how to make a batch movement simulator

Report •

#1
November 1, 2013 at 13:07:44
✔ Best Answer
depending on how you are defining the location of the stuff and door all you would have to do is use an if statement to check to see if the coordinates match.

for example in a room where you have the main charactor, assuming the grid system above, I reset it up to meet the batch display with should be a 23,10 grid

echo ##########?############
echo #; ^!..................#
echo #_^!...................#
echo #.....................#
echo #.....................#
echo #.....................#
echo #._.................._# 
echo #[   ]..............^!$#  
echo #[@]................^!$#
echo ######################


That would put the charactor at (3,9) and the conveint # on the border
IF y equ 10 goto error
if y equ 1 goto error
if x equ 1 goto error
if x equ 23 goto error

:error
if y equ 1 goto check
echo You cannot walk through walls in this game.... && goto cmove(wherever you allow movement
:check 
if x equ 11 goto roomxt (wherever they leave the room)
echo You cannot walk through walls in this game.... && goto cmove(wherever you allow movement

::mike

message edited by mikelinus


Report •

#2
November 1, 2013 at 18:31:34
As Razor pointed out early on, there's no other way than "Manually". There are no easy shortcuts using "conventional" languages, and most especially batch. As far as I know, here's the synopsis:
1) build your "room" into a 2-dimension array either "manually" (sit down
and draw the map) or using randomizer and sophisticated rules.
2) For each tentative, or proposed move ("try") by the player, compute the
intended coordinates that would be occupied were he allowed to move.
3) Test said coordinates to see if there's something blocking that position.
4) If so, keep player pinned in place, else move him to new coordinates.
For #3, you could also keep a running list of forbidden coordinates instead of sampling "real-time" from the world-map.
Same rule-set applies to any "enemies" (hint: large-scope subroutine). Everything else depends on game-rule particulars that are far too specialized to cover here, such as wall-breaching weapons, mines and booby-traps, etc. With batch, each "move", by either the player or the enemies, requires a CLS clear-screen and re-display of the entire grid, as I'm sure you've gathered by now. I'm basically re-stating what Mike said about grid analysis per move.

message edited by nbrane


Report •
Related Solutions


Ask Question