Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Input moving in a different dimension
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Hack.saw




PostPosted: Tue Nov 14, 2006 10:15 pm   Post subject: Input moving in a different dimension

Well, just want to say I'm glad to be back from the Compsci graveyard and am ready to jump back into this fun and helpful community of programmers.

Now I'd like to restart this by hitting my newest project bang on the head. When you use input.keydown for moving an avatar he/she/it gets its own dimension different from the normal X and Y axis of the run screen. Usually when you want to do rectangular hit detection you just move to the spot you want to start in and record the numbers. In the game im making random "holes" apear on the ground. So far I have there code working perfectly but because the two dimensions are different the hole shown does not give any representation of where it actaully is. Because the holes are drawn random every time and at the end of every turn (turnbased game) I can't test them and come up with usable coordinates. If anyone has any method I can use "match" the planes of coordinates, please share Very Happy . I am nearly finished the main part of the game and don't want to go over and re-do all the hit detection for walls and all that so please don't post anything that would cause me to have to do that =) I am going to post my game after lunch tomorow so you can see the code I am talking about but other wise its at school and I can't get it.

P.S. If you suggest what.colour please give some Pseudo code on how to use it for this instance because we have not been taught that yet nad im having troube figuring out exactly what and how it does/works.
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Tue Nov 14, 2006 11:32 pm   Post subject: (No subject)

Alright, if your able to draw these holes, they have chords.

with the chords, you can use the radius, and do a collition detection.

i dont see what your having a problem with, so ill wait untill tomorrow when you post your code, and get an idea of what it is yout trying to accomplish.
Hack.saw




PostPosted: Wed Nov 15, 2006 12:14 pm   Post subject: (No subject)

Ok here it is... Use the arrow keys to move player one during his turn and the usual 'w' 's' 'a' 'd' to move player 2 on his turn. This really dosn't have any commenting ATM because I was just making it for fun =) I did point out the current code im using to see if you fll in a hole. If you want the game to last longer for your test just go to the bottom of the code and change how much points you need to win. BTW you get points by running over the flag and then brining it back to your base.
If anyone has any suggestions on how to make it so you don't have to be exactly over the other player to tag them... please share =)



GeoDemonz.t
 Description:
Beta Testing

Download
 Filename:  GeoDemonz.t
 Filesize:  18.37 KB
 Downloaded:  67 Time(s)

TokenHerbz




PostPosted: Wed Nov 15, 2006 1:44 pm   Post subject: (No subject)

ok, 0 comments, NOT GOOD!!!
regardless if you make this for fun, use the comments, it just makes everything easier for both you, and others.

Now, to your program,

several problems, most on your collition detection.

you wrote: "So far I have there code working perfectly but because the two dimensions are different the hole shown does not give any representation of where it actaully is."

does this mean you dont know where your random holes are?

your code:

code:

        randint (holex1, 1, 640)
        randint (holey1, 1, 310)
        randint (holex2, 1, 640)
        randint (holey2, 1, 310)
        randint (holex3, 1, 640)
        randint (holey3, 1, 310)


There you have it, use those to collide with, Added yo the x/y position is the size of your "hole".

" If anyone has any suggestions on how to make it so you don't have to be exactly over the other player to tag them... please share =)"

each person is a circle, so use circle collition. You have the x,y pos, + the radius. Have it check to see when they touch, thus they wont have to be "over" eachother.

explain your problems better, to get better help Smile
Hack.saw




PostPosted: Fri Nov 17, 2006 12:57 pm   Post subject: (No subject)

Detection im using right now checks to see if the center of the cricles matches eachother exactly. Not sure how to do it anyotherway.
code:
if x = x2 and y = y2 and TC = 0 and flagP2 = false then
        x2 := 500
        y2 := 50
        TC := 1
        P1pts := P1pts + 1

    elsif x = x2 and y = y2 and TC = 0 and flagP2 = true then
        x2 := 500
        y2 := 50
        TC := 1
        P1pts := P1pts + 1
        flagP2 := false
    end if


Now.. ill try and explain my other problem better. Normally I can just take my character and move him to the position I dont want to go past then write an if statement. Becasue it randomly moves the boxes I can't do that and im at a loss on how else to do it. The code Im using right now works but the holes you fall down dont apear where the code has you fall down because the characters x and y are different then the normal plane:
code:
if x > holex1 and x < holex1 + 25 and y > holey1 and y < holey1 + 25 and TC = 0 then
        cls
        loop
            fallen -= 1%not relevent to question
            delay (100)
            Input.KeyDown (chars)
            drawfillbox (0, 0, 640, 480, white)
            locate (1, 1)
            colorback (white)
            color (black)
            put "QUICK! Press the space bar as fast as posible to escape the hole!"
            put "You have pressed it: ", JumpSave, "/9"%not relevent
            Pic.Draw (chara, x, y, picMerge)
            drawfillbox (holex1, holey1, holex1 + 35, holey1 + 35, black)
            View.Update
            if chars (' ') then
                JumpSave += 1
                y += 1
            end if
Clayton




PostPosted: Fri Nov 17, 2006 1:52 pm   Post subject: (No subject)

instead of checking just the exact middle, set up some sort of range, say 10 pixels. Just check in between those pixels to see if the collision happens instead of checking at the middle pixels
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: