Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - PMick

#1
Yep, I think you're right. I experimented with the intitial Y positions of the objects and it definitely changes it. I've got it working fine now, and will remember about manual baselines :)
#2
Sorry for resurrecting an old thread, but I'm trying to use this and I confess I don't know some of the minimal things I need to know. I figured out how to export the rellax scripts from the demo and then import them into my game, and I've created the necessary custom properties, but when I set an object's PxPos and pyPos to anything above 3, the game draws that object in the foreground, covering up another object that is supposed to be in front of it
#3
Yeah, that's exactly what I did. Different function name, but same coding structure.
#4
I'm sure it would have. I was trying to see if I could be more efficient by giving the code a separate function and then calling that function from each of the AnyClicks. I figured what I was doing wrong there on my own and it works great! Thanks again!
#5
Ah, ok. I think I see now. Having trouble making this work in a single function for any Object, but if I can't figure out what I'm doing wrong I'll post again. I can at least get it to work for one object right now.
#6
Ok, I think I see what you've done there. We're creating a room array (maybe that's the same as a global array--not sure). Then within the function we're creating a temporary Dynamic Sprite to work with, and then copying that temporary DynamicSprite into the more permanent room DynamicSprite. One question, though--why is the last line of SomeObject_AnyClick "theObject.Graphic = spr.Graphic?" Shouldn't it be "theObject.Graphic = ObjectSprites[theObject.ID"? If I assign the object's graphic to spr, which was declared within the function, won't spr (and therefore the sprite the object is using) disappear at the end of the function?

Apologies for my newbie questions. Still trying to understand DynamicSprites.

EDIT: I tried doing exactly as you suggested, but I still don't understand how that worked. If you wouldn't mind answering the question above, I'd really like to understand better how this works.
#7
I've spent the last few hours trying to figure out how to do this--been on multiple help sites, including these forums, trying to figure this out and at last I'm throwing in the towel and asking for help.

Here's what I want to do: I have several objects on the screen. I want the player to be able to click on any of these object and have it rotate 90 degrees, keeping that position until the player clicks again to rotate it another 90 degrees. The most obvious way to do this, as far as I can tell, is with an array of DynamicSprites and the DynamicSprite.Rotate command. The problem I'm running into is that I need the DynamicSprite array to be global, so that the effect of clicking an object can last until the player changes it again.  I've tried several different ways to declare the DynamicSprite array outside the function, including in game_start, but when I try, inside the function, to change the values in the array, I'm told I can't assign initial values to a global variable.

I don't necessarily have to use DynamicSprites for this, but I'd like to as it seems like that would be the most efficient coding. The other way I know of to do this would be to have 4 different sprites (created from images I manually rotate myself) for each object, but there are 25 objects on the screen, and my plan is to have several different screens set up this same way. So while this method would avoid the frustrations of DynamicSprites, it would involve making literally hundreds of sprites and taking a very long time.

I'm really hoping there is a way to do this with DynamicSprites, to save me the hours of manipulating graphics. Can someone help me? Again, the goal is to have 25 objects on the screen, and every time the player clicks one, it rotates 90 degrees and stays that way until clicked again.
#8
That's excellent news!  Is there really any reason to use ints when shorts will do the trick, though?  I don't anticipate my variables will ever have to get very huge.
#9
Thank you, you've been a very big help!  Let me be a little more specific and maybe you (or anyone) can tell me if I'm going to start running into memory problems...

I would actually need to do this multiple times. For most of the structs I need to create, it would simply be a set of ints and strings--anywhere from 3 or 4 to maybe 10 or 15 depending on the particular struct. I don't THINK I will need to include any DynamicSprites in any of the structs or arrays--all variables should be ints and strings.  But there would be several different structs and an array for each of them--probably about 7 or 8 different structs that would all need arrays.  Each of these arrays would need to at least be CAPABLE of storing a few hundred of their structs. So, I guess we're talking about a game that could potentially have...I dunno, we'll say a hundred of each struct within each array, multiply that by 10 arrays (just to be safe), and maybe 10 variables per struct...that comes out to about 10,000 variables, mostly of the int and short variety, but with probably at least one String per struct instance.  Can AGS handle this, or should I look for either a different engine or a different solution?
#10
My apologies if any of this is redundant.  I DID run a search for some of my questions regarding structs and arrays and I'm still not entirely certain of the best way to do what I'm trying to do.  If I've made any mistake in posting this, I hope you'll all chalk it up to newbie inexperience.

I am in a bit of confusion about the best way to do what I'm trying to do given the way array sizes work. What I want in my game is this: there is a specific type of game entity (we'll call it a Beef, since I like beef). Now, each Beef has a set of variables that are essentially randomized when a Beef is created. At the beginning of the game, there's only one Beef. However, more Beefs will be created through the player's actions.  That is to say, the player has the power to tell the game to generate a new Beef from time to time. In addition, from time to time Beefs may be destroyed, either by the player or by the game.  This means (a) I as the programmer don't know beforehand how many Beefs will be in any given game, and (b) the number of Beefs will change very often in any given game. After browsing through the AGS help file, it seemed to me that an array of structs was the best way to go. However, as far as I can tell, a normal array in AGS code has a set size declared upon creation. I read the bit about "dynamic arrays", but according to the help file these cannot include structs, and the data within them gets erased any time you change the array size anyway.

So, what is the best way to handle this situation? One thought that occurred to me was just to make the array size massive right from the start--i.e. "Beef beefs[10000000];", and then leave all unused Beef variables empty until new Beefs are generated by the player.  What would be the effects on memory if I did this?  Would this create a huge unwieldy bit of data that would slow down game speed, for example?  Also, this method still has a flaw--although the max is very very high, a max still exists. Ideally I'd like it to be possible for the game to go on forever if desired, so that a player could (in theory) create Beef after Beef after Beef in a very Beef-filled universe (ok, now I'm hungry...)  Is there anyway I can do what I'm trying to do and have there NOT be a limit (beyond the player's machine's computing ability, anyway)?

Again, my apologies if this post is redundant or if the information I need could have been obtained some other way.  I appreciate any help the more experienced folks here could give me--thanks in advance!
SMF spam blocked by CleanTalk