Message Board


Message Board > Fenix / Bennu / Gemix / DIV > Collision and jumping algorithms

June 22, 2007, 15:24
Treval
Whiskered
25 posts
Howdyhoe!

I'm confused about my own code of my Capture The Flag game.
For some reason, after collision(type rock) has occured, the little blue guy suddenly won't jump anymore when you press space. I think it has something to do with my y or yspeed variables. But I'm not sure and I'm confused.

Could you guys help me out please?
I just want the blue guy to keep jumping even if he has touched the rock. I also want to make the guy land on the rock and stay there once he touched its top surface, ya know?

Here's the source:
http://users.telenet.be/treval … the%20flag.rar


Many thanks

Treval
____________
#
June 22, 2007, 15:55
Treval
Whiskered
25 posts
Update:

<ASk> well, see
<ASk> once you do srocktop = true;
<ASk> you never set it to false
<ASk> then, y+=yspeed is always executed
* Ghoularti (~lol@h15.41.28.71.ip.alltel.net) Quit (Remote host closed the connection)
<ASk> so y was 495 at beginning
<ASk> then it grew
<ASk> then below_ground_level = true
<ASk> then y = ground_y
<ASk> essentially, on every loop you add 30 to 495, compare it to 495, see that it's greater and reset it 495
<ASk> it to*
<ASk> and even if you press space
<ASk> you now get 2 conflicting statements
<ASk> one adds 30 to y
<ASk> one subtracts 30 from y
<ASk> so y never changes

Hm interesting..
____________
#
June 22, 2007, 16:45
Treval
Whiskered
25 posts
Help :P
____________
#
June 22, 2007, 17:01
Rincewind
programmer
1545 posts

Hey Treval,

I'm getting a 404 error page from that link, do you have a valid link for me?

Good to see you're Fenix'ing. :)
____________
Personal website: http://www.loijson.com
#
June 22, 2007, 18:45
Treval
Whiskered
25 posts
:) :)

Hello Rince.

I think the %20 spaces are the reason.
'neways here's the link:
http://users.telenet.be/treval/other/

And then
Capture the flag.rar

Hehehe. :P


Treval

p.s.: gonna check my Super Mario World code and see the difference, since Super Mario jumps there correctly, even when he hits a box. :))
____________
#
June 22, 2007, 19:26
yonni
None
420 posts
What version of fenix did you use? (So I know what to compile modifications using)
____________
#
June 22, 2007, 19:47
Treval
Whiskered
25 posts
Not sure. :O

I think it's the A version:

FXC 0.84 (Nov 15 2003 18:57:08) - Copyright © 1999 JosΘ Luis Cebrißn Pagⁿe
____________
#
June 22, 2007, 19:54
Quiest
now with more happynes
142 posts

If you ain`t compiling for gp32 or gp2x, I suggest you try the newest version, I like it very much.
____________
Roundhousekick to the face, baby!
#
June 22, 2007, 19:58
Treval
Whiskered
25 posts
What is gp32/gp2x?
____________
#
June 22, 2007, 22:49
Sandman
F3n!x0r
1194 posts

It's a handheld platform, capable of awesome things.
Also, Flamebird doesn't work with the latest Fenix I thought. But luckily there is the very awesome ConTEXT. And the Wiki about setting up Fenix.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
June 23, 2007, 00:34
Treval
Whiskered
25 posts
Well I would like some more feedback on my problem.

:) welcome
____________
#
June 24, 2007, 16:00
Treval
Whiskered
25 posts
Which means my problem isn't solved yet.

People please help? :P
____________
#
June 24, 2007, 16:21
Rincewind
programmer
1545 posts

Treval, the Capture%20the%20flag.rar from that folder has an older version of your program I think. There's no "rock" in the code anywhere, I get a gameover screen at start and both guys can't jump with space because there's no code implemented for it.
____________
Personal website: http://www.loijson.com
#
June 24, 2007, 17:46
Treval
Whiskered
25 posts
Meh.

Your browser must be getting my old ctf.rar from its cache. Try refresh?

Here's my code:
http://users.telenet.be/treval/txt/ctf_fenix.txt


Treval
____________
#
June 24, 2007, 17:50
Rincewind
programmer
1545 posts

It's not my browser's fault, I empty my cache regularly and it happens with Internet Explorer and Firefox. The file you uploaded at 22 june was simply an old file, download it for yourself.

Edit: I would like to have the full version with your latest fpgs too, so I can actually see what the problem is. And where is this collision(type rock) you are speaking about? I see nothing in your code that shows interaction between your srock process and the blue player.

[Edited on June 24, 2007 by Rincewind]
____________
Personal website: http://www.loijson.com
#
June 24, 2007, 18:16
Treval
Whiskered
25 posts
Well at least now you have my code. >_>
____________
#
June 24, 2007, 18:30
Treval
Whiskered
25 posts
I uploaded the correct .rar now.
I tried it 5 times with FireFox and 5 times with Iexplorer. Firefox kept giving me the wrong file (the game over one)
while internet explorer had downloaded my updated .rar successfully.

Anyway you got the code and stuff


Further help in this is appreciated.
=))

Treval
____________
#
June 24, 2007, 18:42
Rincewind
programmer
1545 posts

Okay thanks Treval, I'm on it.
____________
Personal website: http://www.loijson.com
#
June 24, 2007, 20:10
Rincewind
programmer
1545 posts

Okay, done, the new code for your blue process below. :) A couple of other suggestions: load your fpg files after setting the color depth, make ground_height a global variable instead of a private one, use flags to mirror your graphs(as in the code below), and don't set frameskip to 4 for no apparant reason (second parameter of set_fps()).

Code:
Process guy_blue(file,graph,x,y)
Private
    xspeed=8;
    yspeed=0;

    y_start_acceleration=3;
    y_acceleration=0;

    jump=0;

    ground_height=495; //of course this really should be a global variable

Begin
    Loop
        // Walking the dog
        If (key(_left) or key(_right))
            If (graph==1)
                graph=2;
            Else
                graph=1;
            End
           
            If (key(_left)-key(_right)>0)
                flags=0;
                x-=xspeed;
            Else
                flags=1;
                x+=xspeed;
            End
        Else
        // Standing still
            graph=1;
        End

        // Jumping
        If (jump==0)
            If(key(_space))
                jump=1;
                y_acceleration=y_start_acceleration;   
            End
        Else       
            y_acceleration-=1;
            If (y=>ground_height)
                jump=0;
                y=ground_height;
                y_acceleration=0;
                yspeed=0;
            End
        End

        yspeed+=y_acceleration;       
        y-=yspeed;
           
        Frame;
    End
End


Landing on the rock is up to you. :D

[Edited on June 24, 2007 by Rincewind]
____________
Personal website: http://www.loijson.com
#
June 24, 2007, 21:43
Treval
Whiskered
25 posts

System.out.println("Many ");
i = 0;
for (i=0;i<100;i++) {
System.out.println(" many ");
}
System.out.println("thanks!!!");

:P lol

I shall go try it out.


Treval


[Edited on June 24, 2007 by Treval]
____________
#
June 24, 2007, 21:52
Treval
Whiskered
25 posts

Woohoow looks really nice!
Thanks Rince! Again!

:):)

I hope I will learn from this
:P


[Edited on June 24, 2007 by Treval]
____________
#
June 24, 2007, 22:07
Rincewind
programmer
1545 posts

You're welcome. And I'm sure you will learn from this. If you have any questions regarding the code above feel free to ask.
____________
Personal website: http://www.loijson.com
#
June 24, 2007, 22:56
Sandman
F3n!x0r
1194 posts

1. WHY IS THAT TEXT BLUE
2. Mirroring graphics in a platformer is fucked, because when you have a gun in your right hand, you turn and BAM it's in your left. :(
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
June 24, 2007, 23:00
Rincewind
programmer
1545 posts

Quoting Sandman:
2. Mirroring graphics in a platformer is fucked, because when you have a gun in your right hand, you turn and BAM it's in your left. :(


Ah yeah good point - Treval's mirrored graphics in his fpg had the same problem though. :P
____________
Personal website: http://www.loijson.com
#
June 24, 2007, 23:40
Treval
Whiskered
25 posts

Oh look, it's the ever so cheery Sandokan again. :P
Quoting "Sandomomma":
1. WHY IS THAT TEXT BLUE

You really wanna know? Well, it's so that I am unique amongst all of you. :P Makes me feel special.

^O^

Treval

____________
#

Page 1 , 2


Message Board > Fenix / Bennu / Gemix / DIV > Collision and jumping algorithms

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!