playMaker

Author Topic: Sokoban like game [SOLVED]  (Read 2033 times)

nunesbarbosa

  • Playmaker Newbie
  • *
  • Posts: 5
Sokoban like game [SOLVED]
« on: September 23, 2013, 01:11:22 PM »
Hi. I want to develop a simple Sokoban-puzzle like game but I'm having tons of issues that I'll appreciate your knowledge.

In this game you control a character that moves third dimesionally in a XZ plane and you can move boxes in a grid horizontally or vertically until it reaches a box marquer. When all boxes stands atop the markers, the stage is over.

There are a few restrictions: The player cannot push boxes through walls and though another boxes. The player cannot push adjacent boxes in the same direction. Those restrictions are ridiculous, but are giving me quite a headache when using iTween Move.

There are some other questions:

1. How to grid move and snap the boxes horizontally and vertically based on the player position? (the player can move in 3D)
2. Is there a better way to check for adjacent boxes/walls other than raycasts?
3. Is it possible to load stages from an ASCII file using Playmaker?

Thanks in advance!
« Last Edit: September 25, 2013, 02:47:24 PM by nunesbarbosa »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Sokoban like game
« Reply #1 on: September 24, 2013, 06:11:55 AM »
Hi,

1. Simply use itween and make some defined movement ( for example 10 units, or 5 units), so when a user push a cube, it goes de facto using a virtual grid ( 10*10 or 5*5)

2. raycast is the way to go I guess. you could maintain an abstracted representation of your stage and check in there isntead of in the 3d world. I tend to do that a lot. It helps seperating the 3d and the logic.

3: yes-ish. I have arrayMaker that can read string, you could reac chars one at a time and if it's 1 put a cube, if 0 ignore and move inside your ascii file, line by line.

https://hutonggames.fogbugz.com/default.asp?W715

bye,

Jean

nunesbarbosa

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Sokoban like game
« Reply #2 on: September 25, 2013, 02:46:20 PM »
Jean, thanks for your reply! I managed to work around with your tips.

The 3rd item was a little tricky. I used a xml approach with two loops (height and width) and a few parsers.

This plugin helped a lot:
https://hutonggames.fogbugz.com/default.asp?W1133