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: (Solved) GM8 Help  (Read 2433 times)

0 Members and 1 Guest are viewing this topic.

Ryuza

That one guy
(Solved) GM8 Help
« on: February 04, 2010, 09:13:54 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
Another simple problem I need a bit of help with, does anyone know how I might be able to use all solid objects as a variable? I'm currently using a global variable (global.solids) for collisions with the player. I was wondering if there might be a way to go from having to do "global.solids = par_solid" to "global.solids = 'insert answer here'".

So, anyone know how to use all solid objects as a variable?

Edit: Solved the problem
« Last Edit: February 05, 2010, 03:36:40 pm by RyuKage2007 »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube
Re: GM8 Help
« Reply #1 on: February 04, 2010, 09:27:22 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
I don't really understand what you are trying to do. Could you elaborate a bit more, even give and example.

But from what I think I understand, you want global.solids be a list of all the solid objects in the game/room?
Logged

Jeod

Team Dekunutz, Doubleteam
Re: GM8 Help
« Reply #2 on: February 04, 2010, 09:30:15 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1675
You could picture it like this, Niek...

CODE 1:

If obj_Link collides with obj_solid1, obj_Link stops
If obj_Link collides with obj_solid2, obj_Link stops
If obj_Link collides with obj_solid3, obj_Link stops

What he wants is to reduce the amount of code he has to write, by doing something like this:

If obj_Link collides with global.solids, obj_Link stops

Sorry if I'm wrong, but it sounds like he wants to reduce the amount of written code by using one line which has the same effect as multiple lines. In simpler terms, he wants to group multiple objects together and then use that group as a variable.
« Last Edit: February 04, 2010, 09:33:31 pm by dotd94 »
Logged
"You should challenge your fates. When all else fails, you can still die fighting." ~Yune
___________________________________

Zelda GBC+ Engine for Multimedia Fusion 2
  • Doubleteam Project Page

Ryuza

That one guy
Re: GM8 Help
« Reply #3 on: February 04, 2010, 09:35:25 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
Well, I'm trying to get global.solids to be any object that is marked solid, as long as its marked solid it'll react when that variable is used. At the moment global.solids is equal to "par_solid", and an example of how I'm using the variable is
Code: [Select]
global.solids = par_solid
if place_meeting(x - 1, y, global.solids)
hspeed = 0

I want to replace "par_solid" with a bit of code that would represent any solid objects like doing global.solids = solid(all) or something.

@dotd94:
Something like that, just that the entire "group variable" would consist only of objects checked as solid.

I'm not entirely sure what I'm trying to do is possible though since I'd assume something so useful might be common knowledge.
« Last Edit: February 04, 2010, 09:39:11 pm by RyuKage2007 »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube
Re: GM8 Help
« Reply #4 on: February 04, 2010, 09:44:19 pm »
  • *
  • Reputation: +16/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1634
I just use pärents for my objects. There is a parent_solid that I use for the objects parent_Solid_Upper, parent_Solid_Lower, parent_Action_Objects etc. Those in turn hold the actual detailed objects like chests, walls, doors etc. So a collision with parent_solid means a collision with anything. Plus, it saves on events if you use parents to check for collisions instead of lots of smaller objects. You can then use a switch to determine the actual object you hit later on.

For me it's more flexibel then pilling all solids onto one pile, but that's because I'm working with two floors.
Logged
Re: GM8 Help
« Reply #5 on: February 04, 2010, 09:48:43 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Personally, I would just use parSolid. And any object that is mark as solid, just inherits from parSolid, either directly by having parSolid as a parent or indirectly by having it's parent inherit from parSolid.

If you need the instance id of a specific solid object at a specific x,y. Use either instance_position or instance_place.

instance_position returns the id of the object on x,y.
instance_place returns the id of the object met at x,y.

global.solids seems a bit of a weird thing to do.
Logged

Ryuza

That one guy
Re: GM8 Help
« Reply #6 on: February 04, 2010, 10:01:42 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
I guess I'll just add a few more parents, I only have one right now (par_solid) since I'm not working with a lot of objects, I was just trying to figure out if there was a way to use any solid object as a variable.

What I was trying to figure out was actually a bit of a work around for another problem I had, I was trying to alter parents for an object using some code; basically I had a jump through platform and I had it so it would not have a parent when the player was beneath it and that the parent would be par_solid when the player was above, I kept coming up with a "looping parents" error and decided to try and use all solids as a variable since it was easier (for me) to manipulate the solidity of any object than to change its parents.

I'm still not sure that you guys realize exactly what I was trying to do though, basically I want to try to get a snippet of code that represents all instances with a certain variable (in this case the built in solid variable) in common.
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube
Re: GM8 Help
« Reply #7 on: February 04, 2010, 10:21:28 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
What I was trying to figure out was actually a bit of a work around for another problem I had, I was trying to alter parents for an object using some code; basically I had a jump through platform and I had it so it would not have a parent when the player was beneath it and that the parent would be par_solid when the player was above, I kept coming up with a "looping parents" error and decided to try and use all solids as a variable since it was easier (for me) to manipulate the solidity of any object than to change its parents.
In this case I would make a parent structure like this:

parStandable
  |-> parSolid -> objBlock
  |-> objJumpThroughBlock

In a upward motion you check for parSolid and a downward motion you check for parStandable.

I'm still not sure that you guys realize exactly what I was trying to do though, basically I want to try to get a snippet of code that represents all instances with a certain variable (in this case the built in solid variable) in common.
I think using parents is what coms closest to what you want, I don't think it is possible to do what you want exactly.
Logged

Ryuza

That one guy
Re: GM8 Help
« Reply #8 on: February 04, 2010, 11:58:44 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
I'm still not sure that you guys realize exactly what I was trying to do though, basically I want to try to get a snippet of code that represents all instances with a certain variable (in this case the built in solid variable) in common.
I think using parents is what coms closest to what you want, I don't think it is possible to do what you want exactly.
Okay, I was hoping it was possible but I guess not, I did think of an idea that might work but it requires a lot more code than the way I'm doing it now. Oh well, I'll stick with the parents. That parent structure should work though, thanks.

So, I guess this problem is solved, if anyone wants to see the result of all the questions I keep asking then check out the Project Element link in my signature, at the moment its very basic though, I'll probably update it a bit later with the jump through platforms.

Anyway, thanks again for the help you guys.
« Last Edit: February 05, 2010, 12:05:22 am by RyuKage2007 »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube
Re: GM8 Help
« Reply #9 on: February 05, 2010, 02:57:04 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
Keep in mind you can use instance_id[0 - n-1] and instance_count if you require something that goes through all the instances.
Logged

Ryuza

That one guy
Re: GM8 Help
« Reply #10 on: February 05, 2010, 02:13:25 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
Awesome, when I went to the help to look up a bit more on those two bits of code and I found instance_exists() which apparently only checks for solid instances if I did something like this:

Code: [Select]
if place_meeting(x + 1, y, instance_exists(all))
     hspeed = 0

I think I figured out a good use for instance_count too, thanks a lot Windy.

I had checked the instances part of the help menu right when I started but I didn't think anything in there could help out, guess maybe next time I should try a few more things out.

Anyway thanks for the help you guys.
« Last Edit: February 05, 2010, 02:16:54 pm by RyuKage2007 »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube

Mamoruanime

@Mamoruanime
Re: (Solved) GM8 Help
« Reply #11 on: February 05, 2010, 02:30:14 pm »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Actually I think it's place_meeting that checks only for solid... I can't remember though :s been a while since I've used GM D:

EDIT: I think I misread your last post XD
« Last Edit: February 05, 2010, 02:42:35 pm by Mamoruanime »
Logged
Re: GM8 Help
« Reply #12 on: February 05, 2010, 03:05:12 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Awesome, when I went to the help to look up a bit more on those two bits of code and I found instance_exists() which apparently only checks for solid instances if I did something like this:
That is weird because according to the help files, instance_exists() returns true whether a instance of obj exists or not. You can use instance id for a specific unique instance or all for checking if any instance exists and not only solids.

Well if it works, it works and good luck with it.

Logged

Ryuza

That one guy
Re: (Solved) GM8 Help
« Reply #13 on: February 05, 2010, 03:09:26 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
I thought it was kind of weird too, right now I'm going through everything to make sure its not just reacting to the solid parent again, so far it seems to be working great.

Edit: Okay, now I'm just confused... I went through everything and I have no code whatsoever that is referring to par_solid for collisions and yet I still only collide with objects that have par_solid as the parent, I even duplicated the parent and renamed it and I went right through it.

Edit2: Okay, I'm spending way too much time trying to figure something out when there are so many easier and simpler alternatives, I think I'll stick with parent objects, I made a complete parent that is the parent to all other parents and I'm using that for collisions, so I guess its all set now, thanks for the all the help you guys.
« Last Edit: February 05, 2010, 03:38:07 pm by RyuKage2007 »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube
Pages: [1]   Go Up

 


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



Page created in 0.129 seconds with 63 queries.