Ignore D-Pad Commands

I'd like to use the crank for player movement and ignore D-pad up/down commands. The 'ignore' & 'listen' functions don't seem to allow granular control over the suite of input options and I don't see any way to cancel the event.dy input. Is there any mechanism for mitigating with using goto to offset?

1 Like

I solved my own problem with a few lines of code in the player update event.

Note that my game restricts x-axis movement with 'hidden' wall world tiles, but could be easily adapted for anyone looking to accomplish the same goal (force use of crank or other input mechanism for player control):

	if cancelDPad==0 then
		if event.dy!=0 then
			realY = event.y
			realY -= event.dy
			cancelDPad = 1
			goto event.px,realY
		end
	else
		cancelDPad = 0
	end
	call "calculateMove"
end
2 Likes

One caveat

You'll also need to escape your d-pad handling to allow for manual movement. In my case, I'm using a custom physics engine to control y velocity. See use of the "calculatingPhysics" variable below:

  if calculatingPhysics == 0 then
  	if cancelDPad==0 then
  	  log "event dy = {event.dy}"
  		if event.dy!=0 then
  			realY = event.y
  			realY -= event.dy
  			cancelDPad = 1
  			goto event.px,realY
  		end
  	else
  		cancelDPad = 0
  	end
  else
    calculatingPhysics = 0
  end if
	call "calculateMove"
end
1 Like