 Bug occurs when you move when standing on pushable block
 Bug occurs when you move when standing on pushable block Bug occurs when you move when standing on pushable block
 Bug occurs when you move when standing on pushable block
acme_pjz {l Wrote}:I tested it, found that the bugs regarding squashing and moving a block through scripting is not fixed but it breaks pushable block behavior.Bug occurs when you move when standing on pushable block
 
 


name="Script Test"
size=800,600
tile(Block,0,100)
tile(Block,50,100)
tile(Block,200,100){
   id=block1
   script(onCreate){
      script="
      block1=block.getBlockById('block1')
      print('onCreate, test result: ',(block1==block.getBlockById('block1')))
      "
   }
}
tile(Button,100,100){
   behaviour=toggle
   id=0
   script(playerIsOn){
      script="
      local x,y=block1:getLocation()
      y=y-1
      if y>=0 then block1:setLocation(x,y) end
      "
   }
}
tile(Button,150,100){
   behaviour=toggle
   id=1
   script(playerIsOn){
      script="
      local x,y=block1:getLocation()
      y=y+1
      if y<=550 then block1:setLocation(x,y) end
      "
   }
}
 I think we should look at the code of movable blocks and copy some code from it, maybe write some common subroutine/game logic...
 I think we should look at the code of movable blocks and copy some code from it, maybe write some common subroutine/game logic...
 See the attached video
  See the attached video 20130208_1506_26.avi.zip
 20130208_1506_26.avi.zip
acme_pjz {l Wrote}:When the block is moving up, walking on the block is incorrectI think we should look at the code of movable blocks and copy some code from it, maybe write some common subroutine/game logic...



Sauer2 {l Wrote}:How about something like moveBlock(block1, x, y, speed) which is a reference to a C++ routine, which adds the block to a blocks-to-move list in the C++ code and have a the blocks in the list moved on the common update process?

Edward_Lii {l Wrote}:I think I know what is causing this problem and I'm afraid it's quite tricky to fix.
The velocity of a moving block is determined by it's delta movement since the last frame.
I did the same for every other block, which made squashing work and standing on it, but when the block stops the delta (and therefore the velocity) is still pointing upwards.


acme_pjz {l Wrote}:Yes, I also found that, and tried reset dx/dy every frame in 'Block::move()' function, but it didn't work

Users browsing this forum: No registered users and 1 guest