Quote from: Darmakwolf on 2012-Dec-30Well I meant looking into the code and how it works.
you pretty much use the arrow keys to move, and Z to attack.
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.
Show posts MenuQuote from: Darmakwolf on 2012-Dec-30Well I meant looking into the code and how it works.
you pretty much use the arrow keys to move, and Z to attack.
Quote from: Darmakwolf on 2012-Dec-28Yeah, I tried it. Just been too busy for a while to really delve into it. Hopefully I'll be able to soon.Quote from: Lord_TNK on 2012-Dec-18Quote from: Darmakwolf on 2012-Dec-18I should have time to check it out tomorrow or the day after.
Okay please do! It's one of my... unusual projects... but I think it does what you want!
did you give 'er a try?
Quote from: Darmakwolf on 2012-Dec-18I should have time to check it out tomorrow or the day after.
Okay please do! It's one of my... unusual projects... but I think it does what you want!
Quote from: Darmakwolf on 2012-Dec-18It might be a couple days, but I'll download it and try it.
Okay - attached is my project I mentioned before. I think it does what you are looking to do! Feel free to take what you'd like from it
Quote from: Ian Price on 2012-Dec-141. That makes sense. I tested it out by changing 16 to 8 and 20 to 10, and it still worked.
That's because the "press" variable is being decreased while the player is moving (in total 16 counts) hence the "press" count needs to be more than 16. (1)
My code already makes the character stop until the key is released. You haven't actually improved or understood the code at all. (2)
IF KEY(200) AND dir=0
IF press=0
move=16
dir=1
ENDIF
press=20
ENDIF
IF KEY(200) AND dir=0
IF press=0
move=16
dir=1
ELSE
move=0
ENDIF
press=20
ENDIF
Quote from: Ian Price on 2012-Dec-111. I guess it didn't come across when I wrote it, but my comment about that was mainly simple curiosity.QuoteIFrom my perspective, that could likely be a commonly used type of program, that's listed somewhere I haven't visited.Did it really matter where it came from? (1) You got a simple answer to a simple problem. Glad it was what you were looking for. Something similar probably is listed elsewhere, but that example code is my own, and is actually based on something I am working on at the moment.
The GLBasic forum is filled with beginners, intermediates and experts that will have individual solutions to any problem you can think of. Users have just got to ask for help to a problem in a way that other people understand!
Just because it doesn't come naturally yet, doesn't mean it won't over time. (2)
Quote from: Ian Price on 2012-Dec-11I'm a newbie, both to this site and to programming languages. I honestly am not at the point where thinking up such code comes naturally. From my perspective, that could likely be a commonly used type of program, that's listed somewhere I haven't visited.
Um, why wouldn't I have come up with that myself? It's not exactly rocket science. You ask for help and then wonder if it's pasted from somewhere else. Nice. That's not the best way to ask for help in the future...
Quote from: Darmakwolf on 2012-Dec-11Got a link to it? I can look for it, but I wouldn't know which section, or how many pages in to click.
See my post for Blobo's Quest - that had tile-based movement where the character would move on a grid until the key is released. I imitated RPG Maker's movement system, basically.
Quote from: Ian Price on 2012-Dec-10That is pretty close to what I want. I'll see about incorporating it into the code I'm using.
Moru's code wouldn't work if the characters needed to move exactly 16pixels every time - if you remove your finger from the key before the 16th pixel kicks in then the player might be halfway through a 16x16 square or even 15/16th through it. I presume that the player HAS to move 16 pixels smoothly from start to finish after a key has been pressed.
Here's what I think you want -
...
There are many ways to recreate this.
Quote from: Moru on 2012-Dec-10How do you put that in code?
Keep moving until x or y has passed 16 pixels.
Quote from: kanonet on 2012-Dec-10Well if you run the code from the first post, or the code I later posted (just pick any picture for the sprite), you will see that the sprite moves smoothly and constantly as long as you press a directional button. I want a way to cause the sprite to move a certain amount, and then either stop moving altogether until the key is released, or wait a certain amount of time before moving again.
Maybe you can describe what you want to do in other words? Cause I have no idea what you want to do...
Anyway im out for tonight.
Quote from: Moru on 2012-Dec-10I can just set the speed at a lower amount for that. The point is NOT the speed of the movement but causing the movement to not be constant.
I think #2 is easing. A way of not moving full speed all the time but move at a lower speed, not one pixel each screen update. Faster computer = faster moving.
Try any of these:
http://www.glbasic.com/forum/index.php?topic=8530.0
http://www.glbasic.com/forum/index.php?topic=5892.msg46443#msg46443
Quote from: kanonet on 2012-Dec-091. I meant if there was anything to add other than the LOCAL declaration and the IF adjustments. If that's it, I'll try it out today.
1. Its the code thats needed for one key. If you want to replace multiple keys, you need to do this for each key.
2. Im not sure if I understand what you mean, but if you want to stop movement, just set spritespeed to 0 or set dirx and diry to 0.
Quote from: kanonet on 2012-Dec-091. What I meant was if I could just use that code for each key and then just run it, or if I needed to put any more codes in there.
This is just to show you how you replace one key with my routine, wasnt that your question? Of cause you would need to do more for the other keys.
And your changing of the movement speed is independent from this, can be done with it and without, just in the way you like it. Did you have a look at this one?: http://www.glbasic.com/forum/index.php?topic=5297.msg41251#msg41251
Quote from: kanonet on 2012-Dec-09Would that be all, or would I need to do more?
Short answer:
lets say your code looks like this:// inside main loop:
IF KEY(32) THEN INC dirx
Then you would replace it with this:// on game start, before the main loop
LOCAL backward AS Tkey
backward.SET(32)
// inside your main loop:
IF backward.DOWN() THEN INC dirx