Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Work damn you! Work!  (Read 650 times)

0 Members and 1 Guest are viewing this topic.
Work damn you! Work!
« on: April 18, 2008, 07:13:34 am »
  • All Hail Crappy Sprites!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 34
I'm trying to code platformer movement for an un-named RPG but for some reason the code isn't allowing him to move right on the platform, or jump.

Does anyone think they could go through my code and see what needs to be done? Maybe even optimise the coding I have in there? It's getting annoying, because I have some of the more useful code (Quick weapon switching) partly done (for example, at the moment you can select any weapon)

Also, anyone feel like spriting me a new jump sprite? The one I made looks crappy :/

EDIT: Whoops, forgot the editable, I've attached it in a rar file...
« Last Edit: April 18, 2008, 07:16:50 am by CociCookie »
Logged
~Project List~
-Untitled RPG - Barely Started!

gm112

Re: Work damn you! Work!
« Reply #1 on: April 18, 2008, 07:19:09 am »
I do not use GM, but I am going to suggest that it sounds very much like a collision error. Is it only on a platform? If so, then I'm nearly 100% sure it's a collision detection error. At least that's what it sounds like from reading your post.
Logged
Re: Work damn you! Work!
« Reply #2 on: April 18, 2008, 07:25:24 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4836
Why don't you just do a simple increase speed code? and decrease for when buttons are released?
Logged
  • Super Fan Gamers!
Re: Work damn you! Work!
« Reply #3 on: April 19, 2008, 04:16:51 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +41/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6947
You have something else strange going on there.  When you move off of a platform, you float.  And if you press left while floating, you fall.  i'll have a look at it.

edit: gm and i fixed the walking issue.  Still working on jumping and falling.  Replace your step event code on the player with this:

Code: [Select]
if position_empty(x,y) = true{
    gravity = 0.5
    if playerdirection = 1{
        sprite_index = plrspr_jumpleft;
    }
    if playerdirection = 2{
        sprite_index = plrspr_jumpright;
    }
else
    gravity = 0
}
if vspeed >= 10{
    vspeed = 10
}   
if hud_plrstatscontroller.weaponchange = false{
    if keyboard_check(vk_left) = true{
        playerdirection = 1;
        sprite_index = plrspr_walkleft;
        if position_empty(x,y){
            x -= hud_plrstatscontroller.playeragility*2.5;
        }
        else
        {
            x -= hud_plrstatscontroller.playeragility*1.5;
        }
    }
    if keyboard_check(vk_right) = true{
        playerdirection = 2;
        sprite_index = plrspr_walkright;
        if position_empty(x,y){
            x += hud_plrstatscontroller.playeragility*2.5;
        }
        else
        {
            x += hud_plrstatscontroller.playeragility*1.5;
        }
    }
    if keyboard_check('Z') = true and (!position_empty(0,1)){
        vspeed=-10
    }
}
if keyboard_check_released(vk_left) = true and playerdirection = 1{
    sprite_index = plrspr_idleleft;
}
if keyboard_check_released(vk_right) = true and playerdirection = 2{
    sprite_index = plrspr_idleright;
}

edit2: falling is fixed, just have to fix the jumping now..
« Last Edit: April 19, 2008, 05:01:27 pm by MG-Zero »
Logged



i love big weenies and i cannot lie

gm112

Re: Work damn you! Work!
« Reply #4 on: April 19, 2008, 06:39:34 pm »
Me and MG-Zero took some of our own time to help you out. MG-Zero has redone the collision code, and I've rewritten the mass majority of what you had in the main player object. No known bugs are present. I'll come back later when I add jumping. Or do you want to do that yourself?

EDIT: I may have missed out some stuff that you had in the original, too... When I add jumping I'll see what I missed and then I'll put those in too.
« Last Edit: April 19, 2008, 06:41:18 pm by gm112 »
Logged
Re: Work damn you! Work!
« Reply #5 on: April 19, 2008, 09:05:38 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +41/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6947
Here's GM's with the jumping code..please don't just take the code without looking through, learn how it works to better yourself.  We've commented on everything.
Logged



i love big weenies and i cannot lie

gm112

Re: Work damn you! Work!
« Reply #6 on: April 20, 2008, 01:49:04 am »
I made some quick changes to fix some silly errors. The jumping is awkward, I know.. but I just tweaked it to work a bit better. And the collision isn't exactly perfect. But hey, this is only to help you out. I'm not going to make anymore changes from here on. Good luck with your project :).

EDIT: I made an attempt at fixing up your jump sprite.


http://img182.imageshack.us/img182/2320/horriblespriteattemptts5.png
« Last Edit: April 20, 2008, 03:24:11 am by gm112 »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.049 seconds with 31 queries.