However, when I do so, the sprite does not load. Global.card=sprite_add(working_directory+"\Dragons.png",1,true,false,0,0)Īs you can see, the variable global.card should search for the working directory that stores the file named "Dragons." It is my understanding that you can simply plug this file into your project folder and it will automatically load them from there when using this code or by defining another folder that is within your project folder. For myself, however, it doesn't load the sprite. Everywhere I see people using the code and it works fine for them. The code I am using can easily be found by searching for sprite add external on google and youtube. I am working on a card game sandbox and need to be able to load images from an EXTERNAL source and apply them to an object in game. This is going to have the somewhat comedic side-effect of stretching out Scarfy instead of jumping.I have had it with the game maker forums being fill with bratty children who constantly waste my time with bickering among themselves, so I've decided to try the discussions here for help instead. You’re making use of Scarfy.height when you should be using ScarfyPotistion.y later in when doing your code for jumping.You need to call InitWindow() before you can use LoadTexture(), as InitWindow opens up access to video memory which we would not have access to beforehand.I added comments in this code to where your errors where, but to quickly point them out: ScarfyPostion.y += Velocity //From Tuomo: ScarfyPostion.y instead of Scarfy.height If (ScarfyPostion.y >= HeightW - ScarfyRec.width) //From Tuomo: ScarfyPostion.y instead of Scarfy.height Texture2D Scarfy = LoadTexture("textures/scarfy.png") InitWindow(WidthW,HeightW,"Run,run, run as fast as you can") From Tuomo: This needs to be called before any LoadTexture calls, as this function makes graphics memory available for use DrawRectangle(WidthW/2, PosY, RectH,rectW,WHITE) Įdit: sometimes, I make unique variable names as a way to take notes so that’s why they might be different then the instructors. updating the position each instance of the while loopĭrawTextureRec(Scarfy,ScarfyRec,ScarfyPostion,WHITE) apply gravity per each frame of the while loop If (Scarfy.height >= HeightW - ScarfyRec.width) ground height, if the rectangle is sitting on the bottoom of the window have to make sure that the starting position of the rectangle is on the bottom of the window Dont forget that '!' can negate a boolean InitWindow(WidthW,HeightW,“Run,run, run as fast as you can”) SetTargetFPS(60) Position of the rectangle will appear at the Rectangle’s height, 100 pixles above the bottom of tg ScarfyPostion.y = HeightW - ScarfyRec.height ScarfyPostion.x = WidthW/2 - ScarfyRec.width/2 Putting the center of Scarfy to be in the center of the Window The starting point on the image to be loaded is 0,0 on the top left of the screen The Height is the same as loaded texture Since there is 6 images in one file we draw from, the width will be divided by 6 Custom variable that will load the a section of the loaded png Texture2D Scarfy = LoadTexture(“dapper-dasher-master-textures/texture/scarfy.png”) Gravity by acceleration based on ((pixles/frame)frame) const makes the variable impossible to change Here is my code, and any Help I could get would be great. I know this is a common problem with a wide variety of common solutions, but I am kinda in stump right now. As the title said, Scarfy is not loading.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |