Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - marcelo

Pages: 1
1
Programming Help / Re: Implementing WASD Movement
« on: August 29, 2018, 07:56:02 pm »
 :o :o :o

After installing SDL and using it as the platform, the game runs flawlessly on Debian Linux. That makes a lot of sense now, that X11 was treating the keystrokes akin to a text editor. Thank you so much for your help, I appreciate it a lot.

Also thank you hpg678 for the article, it's really interesting. I had never thought of the concept of time-based movement... definitely something I'll try to implement.

2
Programming Help / Re: Implementing WASD Movement
« on: August 27, 2018, 10:03:58 pm »
Thank you for trying out my code.

I added a background but I still experienced the same lag.. Since it worked for HitCoder I'm thinking maybe I can get it to work by running the code on a Windows installation of Enigma.

3
Programming Help / Implementing WASD Movement
« on: August 27, 2018, 12:03:42 am »
Hi there,

I'm working on simple object that responds to WASD input by moving. The only issue I have is that after a couple seconds of holding down a key, the movement and keystrokes start to lag - I've included a GIF to show what I mean. I've tried both code and blocks, and both of them yield the same output.

Any suggestions would be greatly appreciated, thanks

Creation code:
Code: [Select]
left_speed = 0
right_speed = 0
up_speed = 0
down_speed = 0

Step code:
Code: [Select]
if keyboard_check(ord('W')) {
up_speed = 5
}
else {
up_speed = 0
}

if keyboard_check(ord('A')) {
left_speed = 5
}
else {
left_speed = 0
}

if keyboard_check(ord('S')) {
down_speed = 5
}
else {
down_speed = 0
}

if keyboard_check(ord('D')) {
right_speed = 5
}
else {
right_speed = 0
}

x -= left_speed
x += right_speed
y += down_speed
y -= up_speed

Pages: 1