
-----------------------------------
xHoly-Divinity
Tue Feb 22, 2005 3:54 pm

Slowing Movement with custom-made Joystick
-----------------------------------
When then joystick moves, the block moves with it, as you can see. However, the movement of the block is too fast. How can i slow it down without adding a delay. (What i tried to do was divide the bottom line by 2, but then it wouldn't be an integer value so it shows an error).


setscreen ("offscreenonly")
var x, y : int := 200
var q, r : int := 400
r := 200
proc draw
    drawfilloval (x, y, 30, 30, 12)
end draw
proc erase
    drawfilloval (x, y, 30, 30, white)
end erase
loop
    drawline (200, 200, x, y, white)
    var a, b, press : int
    mousewhere (a, b, press)
    if whatdotcolor (a, b) = 12 and press = 1 then
        if a < 300 and a > 100 and b > 100 and b < 300 then
            x := a
            y := b
        end if
    elsif press not= 1 then
        x := 200
        y := 200
    end if
    cls
    if press = 1 then
        q := q + (a - 200)
        r := r + (b - 200)
    end if
    delay (100)
    drawline (200, 200, x, y, black)
    drawbox (q, r, q + 100, r + 100, black)
    draw
    View.Update
end loop


-----------------------------------
Flikerator
Tue Feb 22, 2005 4:01 pm


-----------------------------------
Make a lot of calculation commands or something in a process and fork it a bunch of times. 


var num : int := 1
process lag
     loop
          num := num + num + num + num
          num := 1
          num := num + num + num + num
          num := 1
          num := num + num + num + num
          num := 1
     end loop
end lag
fork lag
fork lag
fork lag
fork lag
fork lag
fork lag
fork lag


Something to that degree.

-----------------------------------
cool dude
Tue Feb 22, 2005 4:05 pm


-----------------------------------
i would just put a delay in it because forks are bad and i suggest not to use them.

-----------------------------------
Flikerator
Tue Feb 22, 2005 4:07 pm


-----------------------------------
i would just put a delay in it because forks are bad and i suggest not to use them.

You are trying to slow down the program without Delay..The only reason not to use a fork is because it slows down your program, are ugly, and go at different times. All of those dont really matter for what he is doing..

-----------------------------------
xHoly-Divinity
Tue Feb 22, 2005 4:07 pm


-----------------------------------
If i add a delay, then it becomes really laggy, and the movement isn't smooth. Also, it is VERY bad to add a lot of delay when using mousewhere because the drawing of the circle will be delayed. :? Anything else? (P.S. can you explain to me the fork method)

-----------------------------------
Flikerator
Tue Feb 22, 2005 4:31 pm


-----------------------------------
Well if you make a process and then fork it it will slow down your program. The more things in the process the slower it will be. Given its not the best method it works best with a loop. I prefer to use delay but if you dont want to just have a lot of forks.

-----------------------------------
xHoly-Divinity
Tue Feb 22, 2005 4:34 pm


-----------------------------------
Alright, thanks. I was just wondering if it was possible to set something at decimal coordinates e.g. drawbox (50.5, 30.5, 100, 100, black). If it's possible then plz do tell

-----------------------------------
Flikerator
Tue Feb 22, 2005 4:41 pm


-----------------------------------
Alright, thanks. I was just wondering if it was possible to set something at decimal coordinates e.g. drawbox (50.5, 30.5, 100, 100, black). If it's possible then plz do tell

Nope its not possible. You can't have somethign on Half a pixel :P

-----------------------------------
xHoly-Divinity
Tue Feb 22, 2005 5:56 pm


-----------------------------------
I made a new version of the program using fork, however, utilizing fork in the way that it is is no different from using delay. GRRRRR :? , there has got to be another way?!!!!!???

-----------------------------------
Flikerator
Tue Feb 22, 2005 7:01 pm


-----------------------------------
Use a cooldown. That would probably work, talk to "Cervantes" on how to do cooldown, im not entirely sure how to do such a thing yet. Hopefully he won't hate meh for telling people to ask him for help and askign for help myself lolz.

-----------------------------------
Bacchus
Tue Feb 22, 2005 11:00 pm


-----------------------------------
change this part:
if press = 1 then
        q += round((x-200)/2)
        r += round((y-200)/2)
    end if thats basically the distance from the starting points of the joystick to the new position divided by 2 (and rounded to make it an int) that way more lean stick in one direction faster will go

-----------------------------------
xHoly-Divinity
Wed Feb 23, 2005 5:09 pm


-----------------------------------
Wow!! Thanks man, that's good stuff. Well just to show you what the final code of the joystick movement is. I was wondering if you guys can give me an idea of how to apply it to some sort of game, because that would be awesome. I was thinking of some sort of "moving background game".


P.S. Yes, I've already looked at the game ideas section, but most of them don't really apply to this and I want something original. It would be of great help, if you could offer your suggestions :D

-----------------------------------
Flikerator
Wed Feb 23, 2005 5:41 pm


-----------------------------------
Mabey try a ship game of some sort? I never use a joystick so I can't really help you there :P

-----------------------------------
mike200015
Wed Feb 23, 2005 5:55 pm


-----------------------------------
Another idea.. you could do a target practice type game, and you move around with the joystick and shoot the targets by pressing the buttons? :idea:

-----------------------------------
xHoly-Divinity
Wed Feb 23, 2005 6:19 pm


-----------------------------------
I will do both, trust me. I'll give you the end result when i'm done :wink: ! Keep these ideas comming, i'm liking this!!!

-----------------------------------
mike200015
Wed Feb 23, 2005 6:26 pm


-----------------------------------
:lol:  lol.. sounds good!

-----------------------------------
xHoly-Divinity
Wed Feb 23, 2005 6:43 pm


-----------------------------------
I was wondering (I am starting with a boat shooting game) a few things. For the bg could I make it move up vertically just the same way it moves horizontally. Also, I'm wondering if it is possible to have multiple inputs at a time e.g. to be holding and moving the joystick and at the same time be pressing space to fire a missile?

-----------------------------------
mike200015
Wed Feb 23, 2005 9:02 pm


-----------------------------------
 For the bg could I make it move up vertically just the same way it moves horizontally. 

What do you mean by makin the bg move up vertically / horizontally :?:

-----------------------------------
xHoly-Divinity
Thu Feb 24, 2005 3:53 pm


-----------------------------------
What i meen by moving the background, is that the bg scrolls up as you move up. E.g. like in super mario as you move to the left, the background/screen moves left with him

-----------------------------------
mike200015
Thu Feb 24, 2005 5:09 pm


-----------------------------------
ooo.. kk.. got it, but it doesnt technically have to be the bg moving, jus the objects that are in the bg, (ie.shapes in the bg, just make them move..)

-----------------------------------
xHoly-Divinity
Thu Feb 24, 2005 5:16 pm


-----------------------------------
Alright, but would you mind elaborating on that a bit please :)

-----------------------------------
mike200015
Thu Feb 24, 2005 5:24 pm


-----------------------------------
kk.. so say in a game like mario, with the blocks etc. in the background, so if you make sumthing like that, when the character gets to say maxx, and if they press the right arrow key again, then the blocks in the bg will move 1 space to the left, to seem as though you are moving right.
Sorry if i didnt explain it well, might sound a lil confusin :?

-----------------------------------
xHoly-Divinity
Thu Feb 24, 2005 5:27 pm


-----------------------------------
Yeah, there's a tutorial on it. I was just asking if it would act the same way if you wanted it to go up and down as opposed to left a right?

-----------------------------------
mike200015
Thu Feb 24, 2005 5:39 pm


-----------------------------------
oo, sorry. Yea i would assume so, bcuz if u would move up, you just move the shape down, and vice versa for if you move down.

-----------------------------------
xHoly-Divinity
Thu Feb 24, 2005 6:23 pm


-----------------------------------
Mind giving me a link to the tutorial. I remember seeing it but I can't remember where it was :?

-----------------------------------
mike200015
Thu Feb 24, 2005 6:28 pm


-----------------------------------
Sorry,  havent seen the tutorial bout it. Do you know what the topic of it was, so i can search for it, n if i find it ill let you know.

-----------------------------------
xHoly-Divinity
Thu Feb 24, 2005 6:32 pm


-----------------------------------
I'm not 100% sure but I could have sworn it was something along the lines of "moving background", I think there was one recently called "Making background bigger than screen size" or sumfin like that. Thanks man, that would be a big help :)

-----------------------------------
mike200015
Thu Feb 24, 2005 6:38 pm


-----------------------------------
kk.. ill look for it, if i find it ill let you know

-----------------------------------
xHoly-Divinity
Thu Feb 24, 2005 6:41 pm


-----------------------------------
THANKS!!! :D

-----------------------------------
xHoly-Divinity
Sat Feb 26, 2005 1:10 pm


-----------------------------------
Hey, you don't have to worry about it anymore, I found the tutorial I was looking for. I will post a copy of the game when im done so keep updated 8)

-----------------------------------
mike200015
Sat Feb 26, 2005 3:51 pm


-----------------------------------
Hey, you don't have to worry about it anymore, I found the tutorial I was looking for. I will post a copy of the game when im done so keep updated 8)

o.. kk.. yea i was lookin i couldnt find it under the names u gave me .. can u post the tutorial :?:

-----------------------------------
xHoly-Divinity
Sat Feb 26, 2005 4:05 pm


-----------------------------------
As soon as I'm done my game, I will MAKE a tutorial on it :P

-----------------------------------
mike200015
Sat Feb 26, 2005 7:22 pm


-----------------------------------
lol.. kk.. nice :)

-----------------------------------
mike200015
Sat Feb 26, 2005 7:23 pm


-----------------------------------
lol... kk.. nice :!:  :D

EDIT

Woops sorry, didnt mean to post that twice :?
