Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-15-2010, 01:03 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
A couple questions about gravity.

I'm currently working on a side scroller and I'm wondering if there's a way to walk up and down angled tiles or images if that's what's needed? If so could someone point me in the right direction?

My other question is, would it be better to rescript the entire movement system when working with gravity or just rescript what's needed for the gravity to work.
Reply With Quote
  #2  
Old 10-15-2010, 01:04 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Yeah you'll definitely need to go with a custom movement system.
__________________
Quote:
Reply With Quote
  #3  
Old 10-15-2010, 01:09 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I'm pretty sure I released the code to my Mario in Graal remake: http://forums.graalonline.com/forums...hp?t=134257825

Although it's in GS1, it should help you out as it contains gravity and more importantly, the slopes you are asking about.

My method for dealing with slopes was to designate a portion of the tileset to specifically angled slopes, and while those tiles were under the player, snap the player to it proportionally to their position on the tile. For example if a 45degree angled slope is under the player, their y position would be player.y = int(player.y) + player.x%1; Of course, this depends on the direction of the angle. Shallow slopes get a bit more complicated as it begins getting into multiple tile detection, but again, all the code is there.

As for gravity you should definitely start from scratch, it's painful to try to get gravity working with default movement. Hell, even on a small event on UN I ended up coding all custom movement and hit detection just because it was a platformer event.

Also, I seriously suggest putting the physics in a class so you can join all appropriate objects to it, so you can easily apply the worlds physics to all objects.
Reply With Quote
  #4  
Old 10-15-2010, 01:28 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
I just looked at the code and I'm not that good with math so would there be a simpler way to do it using images or is it pretty much the same concept?
Reply With Quote
  #5  
Old 10-15-2010, 01:50 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Cubical View Post
I just looked at the code and I'm not that good with math so would there be a simpler way to do it using images or is it pretty much the same concept?
With images you may be able to do so by manipulating the blocking properties of npc's and onwall. Place an NPC with the slope as the image. Since onwall only considers the actual image blocking and transparency as nonblocking, you can use to pretty much "snap" the player to the closest position of the visual slope. It's hackish, though, as that's what I originally attempted to do.
Reply With Quote
  #6  
Old 10-15-2010, 01:55 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by DustyPorViva View Post
With images you may be able to do so by manipulating the blocking properties of npc's and onwall. Place an NPC with the slope as the image. Since onwall only considers the actual image blocking and transparency as nonblocking, you can use to pretty much "snap" the player to the closest position of the visual slope. It's hackish, though, as that's what I originally attempted to do.
So it wouldn't work as smoothly?
Reply With Quote
  #7  
Old 10-15-2010, 02:18 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Cubical View Post
So it wouldn't work as smoothly?
I don't remember exactly why I ditched the method, to be honest.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.