• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

GameMaker Game Competition | October 1-31, 2015 | Theme: Halloween

Cptkrush

Member
I was able to get my codes all registered and what not. It seems like it might be a lot better now, especially since the sale is over. Hopefully I'll have a solid idea for the game soon, I've been going crazy trying to come up with something. The worst part is that I actually love Halloween and horror, but I seem to be in a creative rut. Hopefully last night's trip to Halloween Horror Nights fed some ideas into my brain subconsciously.
 

BossRush

Member
I don't have any ideas at the moment and I don't think I have the time to focus on learning game maker right now. But I have the software so hopefully there will be future contests
 

Cmagus

Member
Getting the hang of the program now and I've learned a few things in coding which is always good.

Also if anyone is doing pixel art and looking for a good free program check out

Graphics Gale

This is a great little pixel art program and art from it can be imported into Game Maker easy.
 

Insolitus

Banned
Getting the hang of the program now and I've learned a few things in coding which is always good.

Also if anyone is doing pixel art and looking for a good free program check out

Graphics Gale

This is a great little pixel art program and art from it can be imported into Game Maker easy.

Graphics Gale is pretty good, I personally prefer using Aseprite though, has a much better UI, a lot of features, and it's only $10 for the full version.
 
that didn't take long. yoyogames are sending out emails again and giving you steam keys for the license you redeemed on yoyogames.com

just got my android key.
 

Noaloha

Member
I'm still trying to teach myself all the components of the game I want to make before things officially kick off.

It's the game I mentioned earlier, the isometric auto-scrolling shooter based on Zaxxon (youtube video showing the basics of the presentation and gameplay, so the rest of this post hopefully makes more sense).

I've made lots of steady progress getting my head around how Game Maker works and how I can start applying that to the game I'm planning, but today's goal was to learn how to make scrolling backgrounds work.

And I've hit a big old wall on that one.

The problem is the isometric projection of the maps and getting a clean transition.

Here's an example of a level's shape (taken from the Arcade version of Zaxxon).

0iMvX5O.png


I've made some rudimentary mock-ups in MSPaint and thrown them in to some Test Rooms, but I can't figure out a way to get them to loop/tile/tesselate smoothly. They move in the correct direction (x decreases by 6, while y increases by 2, giving the diagonal scrolling to make the player sprite seem like its travelling up and to the right), it moves at the correct speed, etc. etc.

But I can't find a control which, for example, says "the next background will be positioned at x=background_width, but with y offset by -1000. Such that the next background is placed higher to follow on from the diagonal path.


Does anyone know if this is possible?

Or do I have to look at just drawing out an entire level in one background? (I tried this initially with a crappy MSPaint scribbled background -- GM popped up an error saying out of memory when I tried to load it (the image was something ridiculous like 31200x18000, ha).


EDIT:

Had an idea (if there are better solutions, please do share!).

In Game Maker, can I tile two separate backgrounds so that they form a 'checker board' pattern?

Sort of like this:

m3mZWNL.png
 
You can just try using the background as an instance instead of a background. Sure you'll have to do the tiling in a paint program instead of using game maker but it's the easiest way to get the desired function.
 

Noaloha

Member
You can just try using the background as an instance instead of a background. Sure you'll have to do the tiling in a paint program instead of using game maker but it's the easiest way to get the desired function.

Tried that and I did get it to work! Caused its own issues though, haha. Plus, after thinking about it more, tiling in general seems like it might be limiting for what I plan to do.

The solution I think I'm going to use, which I tested this morning, is to have single looooong rooms (but not so long that GM gives me a memory error!) *but* I have slowed down the speed at which the room scrolls so that each 'map' isn't finished in 20 seconds. With my MSPaint skills I have found a background size / level length / scroll speed that feels appropriate.

One thing I realised in this test game -- I've been learning in a static room so far, with fixed 1920x1080 coords. As soon as I did the scrolling thing, which obviously increases the x and y of the room drastically (as the level pans diagonally down across a much smaller view), aaaaall my test enemies and movement boundary boxes are screwed.

I need to go back and remember the stuff I watched about view_hports and view_yviews and get_GUI_x or some such I guess, then try to rely on that instead of hard room(XY)s.
 
You can try this.

The actual view doesn't change. The actual scrolling is done by the instanced backgrounds. You just add more instances to get longer levels.
 

Tregard

Soothsayer
Seems like this thread would be the best place to go for some GameMaker help, of which I need some!

I'm currently trying to create a game that contains 37 instances of the same objects, and every three seconds, I'd like one to be destroyed at random. Essentially, that's all I'm trying to do right now.

However, GML is new to me so I'm having trouble getting any of the instances destroyed at all! Could anyone advise me?
 

Noaloha

Member
Would a 'stationary' object (ie. nothing in any step events is specifically altering its x or y) BUT that is in a room with a scrolling background (so the object's (x,y) within the room is constantly changing) have a hspeed and a vspeed equal to the inverse of the background scrolling, or would (as I hope and assume) Game Maker consider the object's vspeed and hspeed = 0?
 

Cptkrush

Member
Seems like this thread would be the best place to go for some GameMaker help, of which I need some!

I'm currently trying to create a game that contains 37 instances of the same objects, and every three seconds, I'd like one to be destroyed at random. Essentially, that's all I'm trying to do right now.

However, GML is new to me so I'm having trouble getting any of the instances destroyed at all! Could anyone advise me?

Hmmmm, sounds like you need to implement a DS_List, add each instance to the room through gml and add them to the list at the same time. Then generate a random number every three seconds based on the list length. Then you would have the control object say something like:
Code:
with(list_item){
   instance_destroy();
}

I can try to whip something up as an example, but I'd need to research lists a little more. I'm still kinda new at all of this. My best advice would be to go into the help and search for Data Structures, specifically lists or stacks, not sure which would be better in this instance.

Edit: See my post below for a way more in depth explanation and an example project.
 

Noaloha

Member
Seems like this thread would be the best place to go for some GameMaker help, of which I need some!

I'm currently trying to create a game that contains 37 instances of the same objects, and every three seconds, I'd like one to be destroyed at random. Essentially, that's all I'm trying to do right now.

However, GML is new to me so I'm having trouble getting any of the instances destroyed at all! Could anyone advise me?

I'm new also, so treat the following with ALL THE CAUTION, but here goes:


If I were to try this as you describe, I'd first want to create 37 of the objects and give them all a name, then later have a timer which chooses one of the 37 objects randomly and then destroys it.

Which, in code, the best I could manage was:

Creation Event.
Code:
SpawnThirtySevenObjects = false
DestroyCount = 37
Step Event.
Code:
// Spawn 37 objects and give them all a unique name that the game can 'find'.

if SpawnThirtySevenObjects = false
    {
    globalvar "First" = instance_create(x,y,object_name)
    globalvar "Second" = instance_create(x,y,object_name)
    [type all the rest...]
    globalvar "ThirtySeventh" = instance_create(x,y,object_name)
    SpawnThirtySevenObjects = true
    }

    
// Create a three second timer. Every 3 seconds it randomly chooses one of the 37 objects, then destroys it.
         
SecondsBetweenDestroy = 3
SecondsSinceLastDestroy = SecondsSinceLastDestroy + 1/room_speed

if SecondsSinceLastDestroy >= SecondsBetweenDestroy
and DestroyCount < 37
with choose("First","Second",[type all the rest...],"ThirtySeventh")
    {
    instance_destroy()
    DestroyCount = DestroyCount + 1
    }

The immediate thing I'm unsure of with the above is what happens to the 'choose()' function if the variable is not there anymore. Does it go "oh well, whatever" (bad!), or does it immediately try again until it finds one which does exist (good)?
 

retroman

Member
I don't know if I'll have time to create a game for this competition (I'm already working on a game at the moment), but I'll sure be keeping my eye on this thread :)
 

Cptkrush

Member
Seems like this thread would be the best place to go for some GameMaker help, of which I need some!

I'm currently trying to create a game that contains 37 instances of the same objects, and every three seconds, I'd like one to be destroyed at random. Essentially, that's all I'm trying to do right now.

However, GML is new to me so I'm having trouble getting any of the instances destroyed at all! Could anyone advise me?

Ok so this was a lot easier to do than I was anticipating:
https://www.dropbox.com/s/axvicqz5n9fuv8p/ListExperiment.gmz?dl=0

Basically, there's an object controller that spawns all of the objects for you and adds them to a list. Then the controller sets an alarm for 3 seconds. Every 3 seconds a random number is picked from the list, that instance is then destroyed and removed from the list. The process repeats until there are no more instances left.

if you would rather not download the project, here is the setup:
2 objects: obj_instance and obj_instance_controller
no code for obj_instance

obj_instance_controller:
Create:
Code:
/// Initialize the Variables

instance_cnt = 37; // How many do you want?
destroy = 0; // This is used to determine which object will be destroyed
instance_list = ds_list_create() // Creates the list
timer_length= 90; // at 30 fps this is 3 seconds
for(var i = 1; i < instance_cnt; i++){ // Start at 1 to end up with 37, loop through until we reach 37
    ds_list_add(instance_list, instance_create(random(room_width), random(room_height), obj_instance)); // Adds an object to the room, and to the list at the same time. 
}
alarm[0] = timer_length; // Sets the alarm to the time you set earlier

Alarm 0:
Code:
/// The Every 3 Second Code


destroy = irandom(ds_list_size(instance_list)-1) //generates a random integer 0 - however big the list is. 

with(ds_list_find_value(instance_list, destroy)){ //In order to destroy an object that isn't the one you are coding for, you need to use "with()", this will tell gamemaker that we are coding for the instance at destroy's position on instance_list
    instance_destroy();   
}
ds_list_delete(instance_list, destroy); // Remove the position from the list so it won't come up again and cause errors. 
alarm[0] = timer_length; // reset the timer.


This would unfortunately not work because there is no way to remove instances from choose, and that would cause a crash. I'm sure you could workaround by checking if an instance exists before hand, but then you're doing 37 checks for 37 different objects. It's a lot simpler to break it up into a list with no instance naming, and then remove them systematically.
 

Cptkrush

Member
Everyone ready for tomorrow? I finally nailed down an idea for mine. I'm gonna try to blend AdVenture Capitalist with Game Dev Story, and make it candy themed. I started a basic clicker engine today to see if I could figure out how to get that working, and it's surprisingly easy. I think that for the rest of today, I will be sort of mapping out the game on paper, and working out how I want the systems to interact with each other. Tomorrow, I'll start on assets and the base engine in GameMaker. I'm super stoked to get this going, and if it's actually a fun game I'd like to upload it to the Play store when it's finished.
 
It's been so long since I fiddled around in GameMaker, if I have time I'd love to try submitting a little thing.

Will be following the thread and other people's projects in the meantime :)
 
good luck everyone. i'll add one of those countdown timer in OP tonight or tomorrow. depends on when i'm up when it starts lol.
 

Noaloha

Member
Definitely excited to get started on this proper. I wouldn't say I'm ready to start making a My First Game, however small it may end up, but! I am definitely way less not-ready than I was a week ago. This last week of watching tutorials and trying to follow along in GM and trying to reinterpret that content with isometric in mind has taught me a whoooole bunch.

And it'll be fun I think to be able to just sit down and draw some sprites, background art. Try to find an actual 'look' for the game. All my code lessons so far have been done with Tom Francis Tutorial-esque MSPaint blobs.
 

Noaloha

Member
Good luck everyone, have fun!

Progress updates or whatever will be appreciated (especially, in my case, if you're likewise a complete beginner).
 

Cptkrush

Member
Awwww yeaaaah! Good luck to everyone. Remember, the most important thing here is finishing a game, it doesn't have to be amazing. It's all about the experience. I will be getting started and posting updates as soon as I decide to crawl out of bed lol
 

Noaloha

Member
Anyone care to recommend your own (or a more newbie-friendly) workflow for getting sprites up and running?

I typed up a bunch of base system code today, but it was giving me a headache at times - math overdose, etc. So in between that I was fiddling in various paint programs (MSPaint, Paint.net and GIMP) dicking around with a single zombie sprite and trying to figure out a walking animation. It was fun but I just couldn't find any smooth, sane process for drawing the sprites, testing them in motion or on top of one another and then importing them. I ended up just drawing them next to each other in Paint.net and then laboriously select-box, copy-pasting them one by one into GM and having to manually add transparency. Ballache. I was playing with GraphicsGale also, but I'm definitely missing something simple and important with that program -- I found it maddeningly unintuitive, especially flicking around frames without them overlapping.

Anyway, for progress purposes, here's what I ended up with. For what is pretty plainly awful, awful animating, this little zombie's strut ended up having a certain Vince McMahon-esque charm. I was trying to get it to fit the isometric direction he'll be walking, so like from north-east toward south-west, hence why the legs are flailing about all over the place. Drew it in 16x16 and then scaled it up to 96x96.

fhPf2LN.gif
 

Cptkrush

Member
Anyone care to recommend your own (or a more newbie-friendly) workflow for getting sprites up and running?

I typed up a bunch of base system code today, but it was giving me a headache at times - math overdose, etc. So in between that I was fiddling in various paint programs (MSPaint, Paint.net and GIMP) dicking around with a single zombie sprite and trying to figure out a walking animation. It was fun but I just couldn't find any smooth, sane process for drawing the sprites, testing them in motion or on top of one another and then importing them. I ended up just drawing them next to each other in Paint.net and then laboriously select-box, copy-pasting them one by one into GM and having to manually add transparency. Ballache. I was playing with GraphicsGale also, but I'm definitely missing something simple and important with that program -- I found it maddeningly unintuitive, especially flicking around frames without them overlapping.

Anyway, for progress purposes, here's what I ended up with. For what is pretty plainly awful, awful animating, this little zombie's strut ended up having a certain Vince McMahon-esque charm. I was trying to get it to fit the isometric direction he'll be walking, so like from north-east toward south-west, hence why the legs are flailing about all over the place. Drew it in 16x16 and then scaled it up to 96x96.

fhPf2LN.gif
I think this looks awesome! It has this adorable creepiness to it. But I would recommend, instead of blowing up all of your sprites, keep them 16x16 and use a view for your room in gamemaker. Make sure you turn off interpolate colors in the global settings for your game, and it'll look much better.

As for workflow, I use the gamemaker sprite editor or PyxelEdit, which is an indie program that's about 9 bucks. The issue with PyxelEdit is that it's still Alpha, but it works great. Also it saves in it's own format, so I normally just export them as pngs and importing them into gamemaker as spritesheets. PyxelEdit has a nice spritesheet work mode and an awesome preview box.
 

Noaloha

Member
Ha thanks. :) I figure at this stage, any work I do like that, art assets or just placing stuff in a GUI, etc. I'm just going to keep as they are at the first attempt stage. Redoing/tweaking sprites and whatnot feels like busy 'endwork' for when (if!) there's enough time for polish.

And Cptkrush, I never even considered the option of just having a view set to, say, 270p. And having GM up-res it. That might actually solve a few serious issues I was having last week in learning/testing when I was trying to figure out a) how scrolling backgrounds worked and b) how scrolling backgrounds would work in an isometric shooter. I was essentially (and thoughtlessly) defaulting to ensuring I had full 1080p 'corridors', which resulted in *enormous* test backgrounds, like I'm inserting 30,000x10,000 resolution .pngs and wondering why I'm having problems. This is dumb!

I think what happened in my learning is I just took a simple temporary tip from a Tom Francis video to heart and applied it wholescale. He said something like "for now just make sure your 'port' and 'view' and 'room' are all set to your native resolution and we'll come back to it later." I've been stubbornly clinging to "keep view and port at your native res" as some kind of hard and fast rule that I have to abide by. Now that I actually consider it, I have no idea why I held to that so adamantly, ha.
 

Cptkrush

Member
^well views are pretty much unknown to some people, a lot I don't even think mess with them. But they are super powerful, and will definitely make your work a lot faster if you can do lower rez sprites. They are super easy too!

My game is coming along pretty smooth so far, and it's interesting to work with because I've never really done GUI programming or elements, and this game is basically all GUI. So it's teaching me a lot about how the Draw GUI function works, and how to scale things properly for progress bars. I'm having a blast so far.


think I might retool the bars to go up as the time goes down, but I kinda like the way they are.
 

StarVigil

Member
thelastmanbiggerw9qbr.png

First mock-up. I wanna do sort of a horror "walking simulator" with sort of a Lone Survivor vibe.
I have an idea how I want it to look and feel, but I don't know if it's gonna be scary or interesting, so we'll see.
If that fails, I'm gonna do the most boring Candy Clicker in the universe.
Best of luck to everyone!
 

fleck0

Member
After watching the first 8 of Tom Francis' videos this last week I started putting together a basic concept, he does a great job explaining exactly why he's doing what he's doing in the early videos.

So far I want to do some sort of adventure-ish game set in a subway with a lot of interactable objects.

PdP4oaC.gif
 

Noaloha

Member
Oh god there's so much math involved

I'm really feeling this sentiment right now, haha. Gods.

Gonna stick with it, but hoo boy, I'm really chafing at my decision to make, not just an isometric game, but an isometric shooter that revolves around an altitude mechanic. As poorly as Zaxxon's gameplay has held up (and it does hold up quite badly), the people who made it have my undying respect for being a) batshit visionaries and b) better at numbers than I am.

To stay sane I cam up with a name and MSPaint pixeled my way into coughing up a functioning title screen:

In87Nyb.png


'Hex' - rather than Zax - because you pilot a witch who casts hexes! Teehee.

Mouse input only. Haven't yet worked out how to do 'arrow key/enter' menu stuff.


thelastmanbiggerw9qbr.png

First mock-up. I wanna do sort of a horror "walking simulator" with sort of a Lone Survivor vibe.

That's a screen from an atmospheric horror game alright! Love the colours.


After watching the first 8 of Tom Francis' videos this last week I started putting together a basic concept, he does a great job explaining exactly why he's doing what he's doing in the early videos.

So far I want to do some sort of adventure-ish game set in a subway with a lot of interactable objects.

PdP4oaC.gif
I cannot say enough pleasant things about Tom Francis's tutorial. I think it's a case of his teaching style (and he's obviously a capable teacher) clicking with my learning style. The stuff he was saying and doing really cemented quickly, it was great. It was very liberating to suddenly realise that I was taking the stuff he'd been specifically working on and then reappropriating it on a fundamental level into my own very different test project, especially as someone with only a tiny, teeny amount of coding experience under my belt prior.
 
thelastmanbiggerw9qbr.png

First mock-up. I wanna do sort of a horror "walking simulator" with sort of a Lone Survivor vibe.
I have an idea how I want it to look and feel, but I don't know if it's gonna be scary or interesting, so we'll see.
If that fails, I'm gonna do the most boring Candy Clicker in the universe.
Best of luck to everyone!


Looks great man, I'm doing a walking horror simulator too haha
 

Noaloha

Member
EDIT : post deleted, things weren't as simple as I'd described. Maybe I'll repost once I figure things out.
 

dandonnan

Neo Member
I'm making steady progress on my game - an old school Zelda-style dungeon affair.

But I wanted to ask how you guys usually go about save systems. In the past I always tend to use the INI system and have two scripts - one for saving, one for loading - that go through each variable and write it out / read it in. With the way that .ini files get laid out, this generally makes it nice and easy to quickly edit things for testing.

Of course, that also means that it's easy for the end-user to be able to tinker with things that ideally they shouldn't. Reading the documentation, the other options seem to be file_text_ and file_bin_. Using a text file seems to be basically the same as an ini file. But the documentation implies that using binary files should only be done in rare circumstances.

So what other methods are there of saving / loading data that is somewhat encrypted?
 

Noaloha

Member
I'm trying to use draw_sprite() functions to handle shadows.

The way it is working currently uses two draw functions in a regular Draw event:
line 1 -- draw_sprite(shadow)
line 2 -- draw_self()

Drawing in this order ensures that the shadow is always behind the actor.

I'm a little worried though that I'm going to eventually run into problems with the shadow sprite's 'depth' later on when I have walls and suchlike. I'm not aware of any way to adjust a sprite's depth value through code in the Draw event.

I was hoping that I could avoid such issues if I put the shadow's sprite in the DrawBegin event and have the actor's sprite in the normal Draw event. My understanding is that DrawBegin stuff happens before all the objects, ensuring that shadows would always be drawn 'underneath' walls or whatever.

I can't seem to get this to work though, and I can't for the life of me figure out why. If I put my draw_sprite(shadow) code in a DrawBegin event, and the draw-self() in regular Draw event, the shadow's sprite doesn't show up in game. I assume DrawBegin sprites should still be visible on top of the background.

Any ideas why? I must be misunderstanding something basic about this Draw process.

===========================================================================

EDIT: rather than doublepost --

Put up a short, shitty-quality Youtube of my progress so far.

  • Movement along the axes is mostly working.
  • Got the 2 projectile types working.
  • Player health decreases visually on the screen (the cats), with player death after ten hits.
  • Altitude is nearly implemented; shots and collision are somewhat functional. But, as above, I still haven't figured out a solution to neatly handling depth. You can see my high-flying witch being drawn behind zombies on the ground.
  • Figured out a promising way for flying enemies to oscillate as they scroll with the background and keep their shadows in place. This drove me bonkers.


CLICKY
 

Insolitus

Banned
I'm trying to use draw_sprite() functions to handle shadows.

The way it is working currently uses two draw functions in a regular Draw event:
line 1 -- draw_sprite(shadow)
line 2 -- draw_self()

Drawing in this order ensures that the shadow is always behind the actor.

I'm a little worried though that I'm going to eventually run into problems with the shadow sprite's 'depth' later on when I have walls and suchlike. I'm not aware of any way to adjust a sprite's depth value through code in the Draw event.

I was hoping that I could avoid such issues if I put the shadow's sprite in the DrawBegin event and have the actor's sprite in the normal Draw event. My understanding is that DrawBegin stuff happens before all the objects, ensuring that shadows would always be drawn 'underneath' walls or whatever.

I can't seem to get this to work though, and I can't for the life of me figure out why. If I put my draw_sprite(shadow) code in a DrawBegin event, and the draw-self() in regular Draw event, the shadow's sprite doesn't show up in game. I assume DrawBegin sprites should still be visible on top of the background.

Any ideas why? I must be misunderstanding something basic about this Draw process.

===========================================================================

EDIT: rather than doublepost --

Put up a short, shitty-quality Youtube of my progress so far.

  • Movement along the axes is mostly working.
  • Got the 2 projectile types working.
  • Player health decreases visually on the screen (the cats), with player death after ten hits.
  • Altitude is nearly implemented; shots and collision are somewhat functional. But, as above, I still haven't figured out a solution to neatly handling depth. You can see my high-flying witch being drawn behind zombies on the ground.
  • Figured out a promising way for flying enemies to oscillate as they scroll with the background and keep their shadows in place. This drove me bonkers.


CLICKY

The DrawBegin event unfortunately doesn't work that way, If you you put stuff in the DrawBegin event, everything, background, sprites, tiles included will be drawn over it. If you want the shadow to appear under the characters and have the player's depth be separate you're most likely going to have to have them be separate objects with shadow following the player XY coordinates but not their altitude. The only other thing you could do is put all the characters and shadows into one object's draw event and execute them in a certain order, but that would probably be more effort than what it's worth for a small project.
 
I realized I can probably use this time working on my regular GM project than the halloween competition so I'll just provide GML help.

In regards to the shadow stuff, dunno if this will work, just off the top of my head.

line 1 - draw_sprite(shadow)

with (shadow)
{
depth = whatever number you want
}

line 2 - draw_self

Kinda don't have the means to test this atm so no clue if it's actually valid lol.
 

Noaloha

Member
The DrawBegin event unfortunately doesn't work that way, If you you put stuff in the DrawBegin event, everything, background, sprites, tiles included will be drawn over it.

Dang it. I based my understanding off the information on this page, but I guess the example they give there, of layering DrawEnd over Draw over DrawBegin, involves assets with transparency.

It never even occurred to me that DrawBegin assets might be drawn before even the room's background. That's not very helpful for me!

One thing I think I'll test out is, instead of using DrawBegin and then Draw, shifting the stages one later, so using regular Draw for the shadow sprite and drawing actors's sprites in on a DrawEnd event.

Insolitus said:
If you want the shadow to appear under the characters and have the player's depth be separate you're most likely going to have to have them be separate objects with shadow following the player XY coordinates but not their altitude.

This is how I initially was doing shadows. My big problem with this is that there's a tiny 'lag' in how GM renders the player object and its shadow object, such that if my Witch banked to the right or left for too long, the shadow very noticeably (and increasingly) trails behind her along the floor. It looks really sloppy. I assume it's because of some combination of a 1-step delay in rendering couple with the witch's movement having acceleration (changes in hspeed and vspeed) rather than just a fixed (x=x+5 & y=y+1) linear shift.

Insolitus said:
The only other thing you could do is put all the characters and shadows into one object's draw event and execute them in a certain order, but that would probably be more effort than what it's worth for a small project.

Reading around, I do remember seeing other advice similar to this, saying to have a single controller object handle Draw events for objects' sprites. I might look into it, but I don't know if it would solve issues where I need 'depth' to take both y-axis (so, how far to the 'front' or 'back' of the scene they are) and also altitude (the y-value between the actor and the actor's shadow). You can see an example of that clearly not working in the CLICKY video I posted above, at 1min30sec.

I realized I can probably use this time working on my regular GM project than the halloween competition so I'll just provide GML help.

In regards to the shadow stuff, dunno if this will work, just off the top of my head.

line 1 - draw_sprite(shadow)

with (shadow)
{
depth = whatever number you want
}

line 2 - draw_self

Kinda don't have the means to test this atm so no clue if it's actually valid lol.

Tried this one too, ha. No joy. The help-text for 'depth' does state though that "WARNING: You cannot set the depth of an instance in its draw event (all other events are fine). This may lead to some unexpected behaviour and even crash your game!"

I tried putting the code for dynamically adjusting depth into the objects' Step events, but that didn't seem to work either, or I'm doing something wrong.
 

Noaloha

Member
Try putting the depth in the create events

I don't think that would work as code in Create only fires once, when the object is created, or at least I thought. Any working solution to this depth situation has to be able to adjust the object's (or just sprite's) depth value based on position within the room comparitive to other objects.

Like for a regular isometric game, one where objects are always walking around on the floor, you can just specify 'depth = -y' and any object drawn closer to the top of the screen will be behind any object lower down, as you'd expect in an iso perspective. Having iso + altitude however makes it a bit trickier.

I could have two objects, actor and shadow, and have the actor's depth be controlled in the shadow object's code, something with the form of 'depth.actor = self.y * -1', meaning the actor would take a depth value based on the shadow's y-position, but that comes back to a solution whereby I'm using two separate objects for actor and shadow, which I'm trying to avoid because it causes the laggy x-position update between the two at high changes in hspeed.

The somewhat 'fix' I'm using as of this afternoon is to draw the shadow sprites on the screen in a Draw Event, and the actor sprites in a Draw End event. This keeps the shadows always locked on top of the background and the actors always above.

Tomorrow I'm going to code up some walls though (objects that the Witch and flying enemies can go 'over') and place them into the game and find out if there's anyway to make the shadows draw above them, or crowbar some extra 'fake' shadow sprite to pop on screen when the default shadow is drawn below the wall.
 
I don't think that would work as code in Create only fires once, when the object is created, or at least I thought. Any working solution to this depth situation has to be able to adjust the object's (or just sprite's) depth value based on position within the room comparitive to other objects.

Like for a regular isometric game, one where objects are always walking around on the floor, you can just specify 'depth = -y' and any object drawn closer to the top of the screen will be behind any object lower down, as you'd expect in an iso perspective. Having iso + altitude however makes it a bit trickier.

I could have two objects, actor and shadow, and have the actor's depth be controlled in the shadow object's code, something with the form of 'depth.actor = self.y * -1', meaning the actor would take a depth value based on the shadow's y-position, but that comes back to a solution whereby I'm using two separate objects for actor and shadow, which I'm trying to avoid because it causes the laggy x-position update between the two at high changes in hspeed.

The somewhat 'fix' I'm using as of this afternoon is to draw the shadow sprites on the screen in a Draw Event, and the actor sprites in a Draw End event. This keeps the shadows always locked on top of the background and the actors always above.

Tomorrow I'm going to code up some walls though (objects that the Witch and flying enemies can go 'over') and place them into the game and find out if there's anyway to make the shadows draw above them, or crowbar some extra 'fake' shadow sprite to pop on screen when the default shadow is drawn below the wall.

In the past I've used the depth code in the create event and it worked. The objects depth can be set in create as long as it's not changing.

Another option is not even use the draw event. Personally I've used draw event mostly for GUI related stuff so using it on shadows is a bit weird for me. Personally, I'd just have the main sprite create the shadow instance in the create event. Then the shadow's step event mimics everything the main sprite does. The shadow's create event would have it's depth in it at that point.

How dynamic are you trying to make this shadow stuff anyways? Is it just something behind the char or something a lot more elaborate?
 
Top Bottom