Log In  


Hello,

Short time listener, first time caller here. I apologize in advance if this is a basic question!

I'm pretty new to Pico-8 and Picotron development, and I'm trying to set up functionality to allow a little character to jump when I press space. Good news is I can get it to jump. Bad news is that if I hold space, it keeps jumping.

I'm using keyp to handle the button press, like below in my jumping/falling code. Apologies in advance if this code is less than stellar...I'm more a web guy than a game dev.

function updatePlayerYSpeed(entity)
	oldSpeed=entity.ySpeed
	if(keyp("space") and not entity.isFalling and not entity.isJumping) then
		entity.isJumping=true
	end
	if(entity.isJumping and entity.ySpeed>-entity.maxSpeed) then
		if(entity.ySpeed>0) then
			entity.ySpeed = 0
		end
		return entity.ySpeed-entity.speedMod
	elseif(entity.y<yMax) then
		entity.isFalling=true
		entity.isJumping=false
		return entity.ySpeed+gravity
	else
		entity.isFalling=false
		return 0
	end
end

In Pico-8, I can disable the repeat on btnp with the following snippet, but that doesn't seem to apply to keyp, with disableRepeatDelay set to 255.

poke(0x5f5c,disableRepeatDelay)

Does anyone know if there is an equivalent in Picotron? I know the above works if I use btnp, but given the more PC-oriented nature of Picotron I want to map it to specific keyboard controls (or maybe even make it remappable at some point.

Thanks in advance!



On a non-question related note, I just have to say I'm so excited to be playing with all of this. I never grew up with the old Atari computers and all that, so it gives me a feeling of whatever you would call a sense of nostalgia for something you never experienced firsthand.



[Please log in to post a comment]