Menu

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.

Show posts Menu

Messages - Lord_TNK

#1
Quote from: Darmakwolf on 2012-Dec-30
you pretty much use the arrow keys to move, and Z to attack.
Well I meant looking into the code and how it works.
#2
Quote from: Darmakwolf on 2012-Dec-28
Quote from: Lord_TNK on 2012-Dec-18
Quote from: Darmakwolf on 2012-Dec-18
Okay please do! It's one of my... unusual projects... but I think it does what you want!
I should have time to check it out tomorrow or the day after.

did you give 'er a try?
Yeah, I tried it. Just been too busy for a while to really delve into it. Hopefully I'll be able to soon.
#3
Quote from: Darmakwolf on 2012-Dec-18
Okay please do! It's one of my... unusual projects... but I think it does what you want!
I should have time to check it out tomorrow or the day after.
#4
Quote from: Darmakwolf on 2012-Dec-18
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 :)
It might be a couple days, but I'll download it and try it.
#5
Quote from: Ian Price on 2012-Dec-14
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)
1. That makes sense. I tested it out by changing 16 to 8 and 20 to 10, and it still worked.

2. I understand what a program is doing when compiled and run, and when I used the code on my end, the square moved constantly (but 16 at a time) without those tweaks, but paused with them. There might be some differences in how our compilers work.

EDIT: Okay, I tried it again with my tweaks commented out, and now it works properly anyway. Not sure if something changed on my system, or I just wasn't paying attention. Regardless, it's nice to know this can at least be done.
#6
Okay, with Price's code, I actually managed to make it stop until I released the key.

I took this line:
Code (glbasic) Select
IF KEY(200) AND dir=0
IF press=0
  move=16
  dir=1
ENDIF
press=20
ENDIF


Tweaked it to:
Code (glbasic) Select
IF KEY(200) AND dir=0
IF press=0
  move=16
  dir=1
ELSE
  move=0
ENDIF
press=20
ENDIF


And did it for the other three directions. Now the square will not move until I release the button, and the counter goes to zero.

But for some reason, changing "press=20" to another number only works at 17 or higher. Lower numbers ignore the pause. I honestly wonder why that is. I'm still working on more of this though.
#7
Quote from: Ian Price on 2012-Dec-11
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)
1. I guess it didn't come across when I wrote it, but my comment about that was mainly simple curiosity.

2. That's the plan, and should definitely happen with help from all of you.  =D
#8
Quote from: Ian Price on 2012-Dec-11
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...
I'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.

I was just stating I didn't know the origin of that program. If you think I was thinking you plagiarized it, I would have stated so, and not have thanked you or given a happy cloud emoticon in my response.

Quote from: Darmakwolf on 2012-Dec-11
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.
Got a link to it? I can look for it, but I wouldn't know which section, or how many pages in to click.
#9
Quote from: Ian Price on 2012-Dec-10
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.
That is pretty close to what I want. I'll see about incorporating it into the code I'm using.

Now I don't know if you came up with that yourself, or just are pasting it from elsewhere, but thank you either way.  :happy:
#10
Quote from: Moru on 2012-Dec-10
Keep moving until x or y has passed 16 pixels.
How do you put that in code?
#11
Quote from: kanonet on 2012-Dec-10
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.
Well 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.

The real goal is a way to make the sprite move one "square" at a time, the way player characters in the first six Final Fantasy games moved.
#12
Quote from: Moru on 2012-Dec-10
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
I 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.
#13
Quote from: kanonet on 2012-Dec-09
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.
1. 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.

2. I meant moving the sprite one increment, and then either stopping or waiting a split second before moving anymore. If the code you gave can do that, awesome.
#14
Quote from: kanonet on 2012-Dec-09
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
1. 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.

2. I wrote "not movement speed". I had already figured that one out. I did point out a dash button in the code after all. I meant halting the movement, even temporarily.
#15
Quote from: kanonet on 2012-Dec-09
Short answer:

lets say your code looks like this:
Code (glbasic) Select
// inside main loop:
IF KEY(32) THEN INC dirx

Then you would replace it with this:
Code (glbasic) Select
// on game start, before the main loop
LOCAL backward AS Tkey
backward.SET(32)

// inside your main loop:
IF backward.DOWN() THEN INC dirx

Would that be all, or would I need to do more?

I just tried so many things, and nothing seems to have any effect on the constant movement of the sprite (as in any way to pause or halt it, not the speed).