Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Help with functions

Author
Message
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 25th Feb 2018 15:39
Good day,

I'm converting all my old Gosub projects to use functions entirely, and I needed help with understanding a problem.

I wanted to start by loading scene1, and here is the code:




Doing this results in the following error code:

" Failed to add image intro/start.jpg into image id 3 - Image already added with into/start.jpg in main.agc at line 71."

Line 71 is the main loop (Start ())

Anyone care to point me in the right direction ?

Thanks
Shadow Props Digital
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Feb 2018 16:02
Hi

You dont need to put the start function in the do loop. If you put a function in a do loop, the function is started each frame.

You should do :



AGK2 tier1 - http://www.dracaena-studio.com
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 25th Feb 2018 18:34 Edited at: 25th Feb 2018 18:44
Like @Blendman said this error is not caused by using a function. A function is basically much like the gosub pattern conceptually but structured differently with a more formal pattern to increase clarity.

You could load some global variables (or registers or stash values in memory addresses back in machine code days) and jump to a subroutine. The subroutine would then pull that data out... do its thing then possibly return a value by storing it in a global variable (or register in asm). Functions are just a "nicer" way of accomplishing the same thing by providing a more formal / structured interface. So instead of doing something like x=1 : y=2: gosub SetPosition you can instead write SetPosition(1, 2)

If you used gosub in your example you would get the same error...

Typically as @Blendman said you want to only initialize such things (creating sprites, etc) like this one time before your loop.

If you want to have it inside the loop for some reason then the function would just need to check if the sprite already exists and only create it if it does not exist. You'd want to do the same thing for your image in this case.

and the gosub version
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 25th Feb 2018 19:27
Some incredible answers here.

I'll try the code example then let you know.

Thanks
Shadow Props Digital
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 25th Feb 2018 19:35
@Blendman

Quote: "You dont need to put the start function in the do loop. If you put a function in a do loop, the function is started each frame."


I have just tried your solution and it works perfectly.

Thank you so much.

Quote: "
"


@GarBenjamin Your solution also worked perfectly.

I'm trying to move away from GoSubs to functions, in order to make my project much neater.

I'm now going to try a few experiments.

By the way can I encapsulte If statements within a Function block ?

And can I call another function from within a function block ?
Shadow Props Digital
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 25th Feb 2018 19:45 Edited at: 25th Feb 2018 19:48
Hi,

I just tried an experiment where if the screen was touched, it would move to another function,
however I get the same results (error message as soon as the second screen is called).

The second function loads another JPG File if 1.JPG is clicked. But the error comes up if I click on the 2.JPG even though there are no behaviours attached to it.

Shadow Props Digital
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 25th Feb 2018 20:57
What exactly is the error message you're getting?
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Feb 2018 21:35
Hi

Its the same matter as your first post .
Each time your press/hit the spirte 3, thefunction start1 () is run.

I think, you should use this sort of code (for a game, an app....) :



I hope this can help
AGK2 tier1 - http://www.dracaena-studio.com
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 25th Feb 2018 21:56 Edited at: 25th Feb 2018 21:57
@Sh4d0xx
This code will throw an error on your second mouse click, because you are trying to load/add an image to an image id twice



PSY LABS Games
Coders don't die, they just gosub without return
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 26th Feb 2018 03:53
Hello AppGameKit Brethren,

I have to say you all have really cleared things up a little bit.

I'm actually considering encapsulating custom made functions inside a GoSub ?

This way, I can put my if statements into the 'repeat block' ?

@PSY

Quote: "This code will throw an error on your second mouse click, because you are trying to load/add an image to an image id twice"


100% this is the same reason that putting the function () within the main loop also produces the error.

Very good.
@PSY @Blendman @GarBRnjamin, I have bookmarked you all for further help (paid if possible) should I run into any issues.

I'm getting back into AppGameKit, and I have to admit it feels so good.

Thanks
Shadow Props Digital
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 26th Feb 2018 10:09 Edited at: 26th Feb 2018 10:11
Quote: "By the way can I encapsulte If statements within a Function block ?"


Quote: "And can I call another function from within a function block ?"


Quote: "I'm actually considering encapsulating custom made functions inside a GoSub ?"
Forget Gosub

If you're new to functions, you will also find this guide very helpful:
https://www.appgamekit.com/documentation/guides/functions_and_branching.htm

You can also pass variables to functions by reference, not only by value, which is explained here:
https://www.appgamekit.com/documentation/guides/12_array_changes.htm

Endfunction and Exitfunction can also return values!


PSY


PSY LABS Games
Coders don't die, they just gosub without return
Supertino
6
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 26th Feb 2018 11:21 Edited at: 26th Feb 2018 11:34
Late to the party

but going back to Sh4d last post he could run a check inside the functions to not load & make a sprite if it exists.




But sticking with the original code I's make the following changes;
1. Load\Create the sprites as the program starts
2. Show\Hide sprites as required

Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 26th Feb 2018 12:48
@supertino :
instead of :



You could do (in this case) :



AGK2 tier1 - http://www.dracaena-studio.com
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 26th Feb 2018 16:04
@Blendman and all the contributors, I just got back in the house, and tonight is gonna be AppGameKit 2 NITE!

I will be testing out your solutions because it seems GoSubs let me do what I want, but is SEVERELY Limited.

@Supertino, many thanks for your suggestion. I will try that out too.

@Psy thanks for the heads up.

So from the looks of things, GoSubs will be completed taken out ?

So I can build this whole project purely on functions, If, else e.t.c. ?

Many Thanks
Shadow Props Digital
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 26th Feb 2018 16:49
Yeah there is no need for use of gosub. Not saying I see using gosub as wrong just that I see no reason to use it when using a function increases code clarity gives you the same functionality of gosub plus gives you additional functionality that gosub does not. The only reason I included gosub examples in my post was to show the error was not caused by using a function instead of using gosub.

The main thing is to just take a bit of time to design your program before you start. Not saying at a micro super detailed level but just a very high level. Identify initialization phase, main loop phase, clean up phase etc. Plan how you will use the objects (images and sprites in this case) what is needed and initialize that up front as @blendman illustrated.

Good luck!
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Feb 2018 17:56
The two major differences between using gosub versus function is that gosub cannot take any parameters and it has a broader variable scope, where as a function may only access local variables and whatever is passed to it. To mimic a gosub with a function, imagine making every variable in your program global. And chances are, you'll never really see anyone use gosub outside of any BASIC language.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 26th Feb 2018 18:47
Quote: "where as a function may only access local variables and whatever is passed to it"

This is technically incorrect, as functions can access global variables, too.
You probably wanted to say they shouldn't..



PSY LABS Games
Coders don't die, they just gosub without return
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Feb 2018 22:53
well yes, globals of course. But you shouldn't make everything global. Not sure if it's that big of a deal in game programming, but in web programming that'd be a big no-no.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 26th Feb 2018 23:07
I agree. You should avoid globals if you can.
But sometimes they make perfect sense.



PSY LABS Games
Coders don't die, they just gosub without return
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 27th Feb 2018 01:47 Edited at: 27th Feb 2018 01:54
Regarding globals... I have no problem with using them. I get the risk is always there of any code being able to access global data at any time but I feel that at some point a developer has to take responsibility for this kind of thing themselves. Just because we can ad hoc access and change any global at any time from anywhere is not a problem. It is when a person is just ad hoc accessing and changing globals at any time from everywhere that problems might come in and be difficult to track down.

I have kind of come full circle in a way in my programming life. Learning and embracing the patterns / best practices and then starting to question them and now I don't agree with all of the modern thinking about this kind of stuff because a lot of it is just adding more work & increasing the complexity of programs only for the purpose of trying to get around mistakes made from not fully understanding the problem, help very inexperienced developers not have to deal with the risks or facilitating working in a team of programmers. A lot of it is good in practice of course. And a lot of it is just someone's opinions written down and accepted as a best practice based on a horror... er case study or two that supports it. And a lot of it is to fix other best practices where you end up with a chain of use this... aha now we have this risk to deal with... that's okay here is another pattern to use for that... great ah now we have this issue... well you just add this additional layer...

Ultimately, we can enforce whatever patterns & practices we want. And simpler is better IMHO. I might prefix all functions and variables intended to be private to a code file with some word or letter to aid in code clarity. Really I see the lack of having all of the modern things shoved down our throats in AGK2 as actually offering us a lot of freedom. Makes it all interesting.

Alright enough of my rambling just saw the discussion about globals and thought I would throw my two cents (half a cent?) in. lol
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 27th Feb 2018 11:36 Edited at: 27th Feb 2018 11:38
I also have no problem with using them. Just saying if you can avoid them without any drawbacks, you should do it

I normally handle globals like this:



So basically, all globals begin with a g., like g.level, g.moves etc. This way, I can't mix up them with locals

The only other global in my code is normally


PSY LABS Games
Coders don't die, they just gosub without return
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 27th Feb 2018 13:50 Edited at: 27th Feb 2018 13:51
@PSY That's very clever! I've considered and have used types to wrap up groups of like data and will do similar in my fps project during code clean phase BUT I hadn't specifically thought of wrapping all of the globals up like that in a variable named simply g.

I like that. Tidy and easy on the typing.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Feb 2018 16:04
I'll usually prefix all my globals with an underscore. But I like your idea, less chance of accidentally making a dynamic variable from a typo. (more of an issue in DB than AppGameKit now)
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2018 06:27


I really like this discussion.

I'm out today, so when I get back I will post my code, the errors I received and e.t.c.

Shadow Props Digital
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 3rd Mar 2018 11:12
Hey!

@Blendman: The code example you gave throws up and error:

main.agc:177: error: Unexpected token "until"
Sh4xx
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Mar 2018 12:35
He's missing an ENDIF to close off If getpointerpressed () before the UNTIL statement.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 3rd Mar 2018 13:53
" main.agc:155: error: Variable "buton" is used without being defined or initialised"
Sh4xx
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 3rd Mar 2018 15:25
It seems to me that AppGameKit does not have a means to de-activate a sprite ?

By de-activate I mean I can stop it from responding to input.

If I have a sprite in a view between somewhere on view (x = 0, y = 0) , it seems moving to another view and clicking on the same spot still works even though the sprite is not in that view.

Weird and frustrating.



Sh4xx
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 3rd Mar 2018 15:53
At PSY ; yeah, I noticed the official Tier 1 Guides vol 1 and vol 2 also use that approach for globals, seems pretty tidy in terms of coding. However.... wouldn't it be true most games will have multiple instances of the same enemies or items, each with their unique values but ALSO their global values?

Other functions might need to know how much XP killing a certain enemy gives or what type of attack was done, but at the same time positions, health and so on need to remain local functions, right? Last but not least, isn't the downside of using 'global G as GameType' that everything becomes global? Maybe I should use more functions that also return values though, as I tend to slack a bit when it comes to that. I'm sure my code in general is messy and chaotic more so than well-structured LOL.
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 3rd Mar 2018 17:39
Quote: "At PSY ; yeah, I noticed the official Tier 1 Guides vol 1 and vol 2 also use that approach for globals, seems pretty tidy in terms of coding. However.... wouldn't it be true most games will have multiple instances of the same enemies or items, each with their unique values but ALSO their global values?"

That would by types, which are global anyhow

You can't avoid using globals, but on the other hand, they aren't bad or evil

Just keep it well structured and you're good to go


PSY LABS Games
Coders don't die, they just gosub without return
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 3rd Mar 2018 20:43
Quote: "If I have a sprite in a view between somewhere on view (x = 0, y = 0) , it seems moving to another view and clicking on the same spot still works even though the sprite is not in that view.

Weird and frustrating."


but also handy to setup hotspot areas, you can avoid click confusion by using groups and/or a state machine so if a sprite is hidden and should not respond to input then the code state does not check input for that sprite or group of sprites, again it all comes down to structure.

also be sure you are checking the right world/screen position with ScreenToWorld* and WorldToScreen*
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 4th Mar 2018 10:36
@PartTimeCoder

Thanks for your advice. I have 5 sprites each meant to take me to another view each time they are clicked.

But when I click on the sprite, it goes to the view alright, but the 5 sprites somehow seem to still be active and don't respond to hide/inactive commands.

You reckon sprite groups could solve this ?

Because each of the 5 sprites correspond to a different thing/end result.

By the way this weird behaviour is from the GoSub version of the project.

Thanks
Sh4xx
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 4th Mar 2018 10:54
@PartTimeCoder

Your suggestion might just do the trick.

Come to think of it, grouping allows for isolation.

Very smart. Very very smart.
Sh4xx
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 6th Mar 2018 16:18
Sadly, still no joy :-(
Sh4xx
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 6th Mar 2018 18:50
A screenshot of the 5 sprites or some code would be useful, so we can help.

There are different solutions to your problem, but we need some more info


PSY LABS Games
Coders don't die, they just gosub without return
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 11th Mar 2018 20:21
Hey guys!

I seem to have figured out a way using Virtua buttons, but it seems the maximum amount of virtua buttons that can have an image is 15 ?

Is this correct ?

Thanks
Sh4xx
puzzler2018
User Banned
Posted: 11th Mar 2018 21:32
in my opinion, virtual buttons look unprofessional on apps given whats out there at moment (we dont see anything like them in games these days)

but if thats the way you want to go then thats your decision.

Personally, i would design my own


Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 12th Mar 2018 08:00
@puzzler2018

" Personally, i would design my own "

Yes, this would be nice if there was documentation on it.

And while virtual buttons look unprofessional, they are much better than dealing with sprites at the moment (AGK sincerely needs to up the sprite game. It's 2018 for crying out loud).

But then a new limitation is the button image (Maxes out @ 15).

One can design buttons, but with no documentation on such, It now becomes an added problem.
Sh4xx
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Mar 2018 12:33
Quote: "(AGK sincerely needs to up the sprite game. It's 2018 for crying out loud)."


Update it to do what? Other than me wanting the ability to add a bit mask to a sprite, what else would you need it to do? And why would anyone need documentation to create a button with a sprite? Check if mouse (or pointer) was clicked within a a target area (the sprite's boundaries):



If you're using virtual buttons, I'll assume this is targeted at a phone or tablet. In which case, I think if you have more than 15 buttons on that screen then you need to redesign your UI.


According to the help file, it says you can have up to 100 virtual buttons. Are you getting an error after 15?
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 12th Mar 2018 13:56
You can't have documentation on everything.
Not to mention the fact that the example projects and the online help provide more than enough samples and instructions how to use sprites as buttons.
Here's one from the documentation:
https://www.appgamekit.com/documentation/examples/input/5_hitting_a_sprite.htm
You simply load an image, create a sprite with that image, and check for user touch / click in combo with GetSpriteHit()


I also think that the sprite commands provide more than enough power at the moment. What commands would you like to have?


Can you give us a basic layout of your menu or whatever you need the buttons for, so we can give you some code or hints in the right direction?


PSY






PSY LABS Games
Coders don't die, they just gosub without return
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 12th Mar 2018 16:28
@Phaelax

Quote: " what else would you need it to do? "


That's scary.

Quote: " I think if you have more than 15 buttons on that screen then you need to redesign your UI. "


Reading this sentence just pushed me to pay for a license for another engine (for real).

Quote: " According to the help file, it says you can have up to 100 virtual buttons. Are you getting an error after 15? "


No error messages come up. The 16th Button just shows up as normal even when the SetImage Up and Down are mapped to it.

I checked it many times to make sure I wasn't doing something wrong. And yes, the 16th Button just stays as the default.

I have read the documentation, but what I think we have here is a bug.
Sh4xx
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Mar 2018 19:53
Quote: "I have read the documentation, but what I think we have here is a bug."

That's a possibility, I might have to try this at home later and see if I can confirm the issue.

Quote: "Reading this sentence just pushed me to pay for a license for another engine (for real)."

I don't see why, but hey it's your money. I'm under the impression you wanted over 15 different buttons on a mobile screen at a time. To me, that would be way too cluttered.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Mar 2018 20:16 Edited at: 12th Mar 2018 20:17
Quote: "But then a new limitation is the button image (Maxes out @ 15)."

I've just tried 22 different virtual buttons with 22 different images on them and they worked fine. Are you sure YOUR not doing something wrong?

Quote: "Yes, this would be nice if there was documentation on it. "

There's documentation on creating sprites and with detecting mouse clicks and touch events on them.
https://www.appgamekit.com/documentation/commands.html
Its very very simple to create a sprite then check if its been clicked on/touched

Quote: "Reading this sentence just pushed me to pay for a license for another engine (for real)."

Its probably for the best judging from this thread...bye then!
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 12th Mar 2018 20:40 Edited at: 12th Mar 2018 20:41
@Sh4d0xx what exactly are you having so much of a challenge with? If you post some code (or an archive of some source if media is needed) people can see what the issue is and be in a much better position to help.

People need details. Like when you say sprites need to be upgraded can you give some examples? From what I have seen in other frameworks and game engines AppGameKit sprite functionality is on par with Unity, Gamemaker Studio, Phaser, etc. The only real difference I see is those have community built assets to give them additional features in some cases. Is that what you mean like shader FX packs for sprites, normal maps for lighting and so forth?
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
puzzler2018
User Banned
Posted: 12th Mar 2018 20:46
You do know your calling Start() function in your main loop

and in the Start function your calling a Load command with object 3

puzzler2018
User Banned
Posted: 12th Mar 2018 20:46
Try

puzzler2018
User Banned
Posted: 12th Mar 2018 20:51
Blendman nearly got it

you would need to put the spriteposition in the main loop - otherwise it will turn all black on the 2nd sync
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Mar 2018 23:30
@puzzler....
Blendman did get it right back on Feb 25th and answered the problem correctly. I dont think you have read the whole thread.

Sh4d0xx wrote: "@Blendman
I have just tried your solution and it works perfectly.
Thank you so much."


The problem the original poster is now having is with images on Virtual buttons. He thinks he has found a bug...

Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 13th Mar 2018 03:48
@Bengismo

Thanks for your comments.

Your code samples not only provided a solution, but proved I was wrong.

.....
Sh4xx

Login to post a reply

Server time is: 2024-04-20 14:02:26
Your offset time is: 2024-04-20 14:02:26